:root {
  color-scheme: light;
  --ink: #17252b;
  --muted: #687980;
  --muted-2: #89989d;
  --line: #dce7e5;
  --line-strong: #c7d8d5;
  --paper: #ffffff;
  --canvas: #f3f8f7;
  --teal-50: #eefaf7;
  --teal-100: #d9f2ec;
  --teal-500: #12977f;
  --teal-600: #0f766e;
  --teal-700: #0c625d;
  --amber-50: #fff8e8;
  --amber-500: #d68b13;
  --red-50: #fff2f1;
  --red-500: #c84e4e;
  --shadow-sm: 0 1px 2px rgba(20, 45, 49, 0.05), 0 4px 18px rgba(20, 45, 49, 0.04);
  --shadow-md: 0 10px 30px rgba(20, 45, 49, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

/* Author styles such as .empty-state use display:grid; keep the semantic
   hidden attribute authoritative so empty placeholders do not show beside
   populated results/tables. */
[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -5%, rgba(117, 213, 190, 0.18), transparent 32rem),
    radial-gradient(circle at 93% 3%, rgba(233, 210, 138, 0.12), transparent 28rem),
    var(--canvas);
  line-height: 1.55;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input:focus-visible,
button:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(18, 151, 127, 0.22);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1320px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.08em;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--teal-500), var(--teal-700));
  box-shadow: 0 7px 18px rgba(15, 118, 110, 0.24);
}

.brand-lockup h1 {
  margin: 0;
  font-size: clamp(21px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.brand-lockup p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(18, 151, 127, 0.12);
}

.status-dot.is-loading {
  background: var(--amber-500);
  box-shadow: 0 0 0 4px rgba(214, 139, 19, 0.12);
}

.status-dot.is-manual {
  background: var(--amber-500);
  box-shadow: 0 0 0 4px rgba(214, 139, 19, 0.12);
}

.status-dot.is-error {
  background: var(--red-500);
  box-shadow: 0 0 0 4px rgba(200, 78, 78, 0.12);
}

.entry-count {
  padding: 3px 9px;
  color: var(--teal-700);
  font-weight: 600;
  border: 1px solid var(--teal-100);
  border-radius: 999px;
  background: var(--teal-50);
}

.app-main {
  display: grid;
  gap: 18px;
}

.app-main,
.app-main > *,
.panel > *,
.site-intro-hero > *,
.billing-layout > *,
.document-meta > *,
.history-item > *,
.pdf-backup-item > * {
  min-width: 0;
}

.panel {
  padding: clamp(18px, 2.3vw, 28px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(199, 216, 213, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.site-intro-panel {
  position: relative;
  overflow: hidden;
  border-color: #acd7d0;
  background:
    radial-gradient(circle at 96% -10%, rgba(18, 151, 127, 0.16), transparent 22rem),
    linear-gradient(145deg, #ffffff 0%, #f4fcfa 68%, #eef9f6 100%);
}

.site-intro-panel::before {
  position: absolute;
  top: -54px;
  right: 14%;
  width: 150px;
  height: 150px;
  content: "";
  border: 1px solid rgba(18, 151, 127, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.site-intro-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 0.34fr);
  align-items: center;
  gap: clamp(20px, 4vw, 54px);
}

.site-intro-copy h2 {
  max-width: 820px;
  margin: 6px 0 9px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.site-intro-lead {
  max-width: 880px;
  margin: 0;
  color: #526970;
  font-size: 15px;
}

.deepseek-api-emphasis {
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 940px;
  margin-top: 17px;
  padding: 13px 15px;
  border: 1px solid #a8dcd2;
  border-radius: 14px;
  background: rgba(232, 248, 244, 0.88);
}

.deepseek-api-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  background: linear-gradient(145deg, #159b83, #0c625d);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.2);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.deepseek-api-emphasis div {
  display: grid;
  gap: 2px;
}

.deepseek-api-emphasis strong {
  color: #0b5f59;
  font-size: 14px;
}

.deepseek-api-emphasis span:not(.deepseek-api-mark) {
  color: #53716f;
  font-size: 12px;
}

.site-intro-actions {
  display: grid;
  gap: 10px;
}

.site-intro-actions .button {
  justify-content: center;
  width: 100%;
  text-align: center;
}

.site-intro-features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-top: 20px;
}

.site-intro-features article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 9px;
  padding: 14px;
  border: 1px solid #d3e7e3;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.8);
}

.site-intro-features article > span {
  grid-row: 1 / 3;
  color: #67a89d;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
}

.site-intro-features strong {
  font-size: 14px;
}

.site-intro-features p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.deepseek-setup-guide {
  position: relative;
  z-index: 1;
  margin-top: 17px;
  overflow: hidden;
  border: 1px solid #b9dcd6;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.88);
}

.deepseek-setup-guide > summary {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  cursor: pointer;
  list-style: none;
  color: #164f4d;
  background: linear-gradient(90deg, #edf9f6, #f8fcfb);
}

.deepseek-setup-guide > summary::-webkit-details-marker {
  display: none;
}

.deepseek-setup-guide > summary > span:first-child {
  display: grid;
  gap: 2px;
}

.deepseek-setup-guide > summary strong {
  font-size: 16px;
}

.deepseek-setup-guide > summary small {
  color: #6d8387;
  font-size: 12px;
}

.guide-expand-hint {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  padding: 5px 10px;
  color: var(--teal-700);
  border: 1px solid #b9ddd7;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.guide-expand-hint::before {
  content: "展开教程";
}

.deepseek-setup-guide[open] .guide-expand-hint::before {
  content: "收起教程";
}

.deepseek-guide-content {
  display: grid;
  gap: 20px;
  padding: clamp(17px, 2.5vw, 26px);
  border-top: 1px solid #d8e9e6;
}

.deepseek-guide-content h3,
.deepseek-guide-content p {
  margin: 0;
}

.deepseek-guide-content h3 {
  font-size: 15px;
}

.deepseek-guide-content p {
  color: #5e747a;
  font-size: 13px;
}

.deepseek-guide-content a:not(.button) {
  color: var(--teal-700);
  font-weight: 700;
  text-underline-offset: 3px;
}

.deepseek-guide-content code {
  padding: 1px 5px;
  color: #0b625c;
  border: 1px solid #cce5e0;
  border-radius: 5px;
  background: #edf8f6;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.deepseek-usage-flow {
  display: grid;
  gap: 11px;
}

.usage-flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.usage-flow-grid > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #d7e7e4;
  border-radius: 12px;
  background: #fbfdfd;
}

.usage-flow-label {
  color: #16816f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.usage-flow-grid strong {
  font-size: 13px;
}

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

.deepseek-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid #d4e6e2;
  border-radius: 12px;
  background: #fff;
}

.step-number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  border-radius: 10px;
  background: var(--teal-600);
  font-size: 13px;
  font-weight: 900;
}

.deepseek-step > div {
  display: grid;
  gap: 5px;
}

.api-security-note {
  display: grid;
  gap: 11px;
  padding: 16px;
  color: #405d5c;
  border: 1px solid #9ed5ca;
  border-radius: 13px;
  background: #eaf8f4;
}

.api-security-note > div {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.security-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--teal-600);
  font-weight: 900;
}

.api-security-note > div > div {
  display: grid;
  gap: 4px;
}

.api-security-note > p {
  padding-top: 10px;
  border-top: 1px solid rgba(15, 118, 110, 0.16);
}

.api-troubleshooting {
  display: grid;
  gap: 10px;
}

.troubleshooting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.troubleshooting-grid > div {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-left: 3px solid #a9d8cf;
  background: #f8fbfa;
}

.troubleshooting-grid strong {
  color: #314f53;
  font-size: 12px;
}

.troubleshooting-grid span {
  color: #687d82;
  font-size: 12px;
}

.official-error-link {
  justify-self: start;
  font-size: 12px;
}

.billing-panel {
  border-color: #b8d9d4;
  background: linear-gradient(145deg, #ffffff 0%, #f2fbf9 100%);
}

.billing-heading {
  margin-bottom: 18px;
}

.billing-summary {
  cursor: pointer;
  list-style: none;
}

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

.billing-summary-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.billing-collapse-hint {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--teal-700);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.billing-collapse-hint::before {
  content: "收起";
}

.billing-panel:not([open]) .billing-heading {
  margin-bottom: 0;
}

.billing-panel:not([open]) .billing-collapse-hint::before {
  content: "展开登录";
}

.billing-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid #b9e5db;
  border-radius: 999px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 700;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 2fr);
  gap: 16px;
}

.balance-card {
  display: flex;
  min-height: 148px;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  border-radius: var(--radius-md);
  background: #0f766e;
  color: #fff;
}

.balance-label {
  color: #c9f2ed;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.balance-card strong {
  display: inline-block;
  margin: 4px 4px 2px 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
}

.balance-status {
  margin-top: 12px;
  color: #d9f7f3;
  font-size: 12px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.plan-card {
  display: flex;
  min-height: 148px;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid #cde3df;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
}

.plan-card h3,
.plan-card p {
  margin: 0;
}

.plan-card h3 {
  color: var(--ink);
  font-size: 16px;
}

.plan-price {
  color: #0f766e;
  font-size: 28px;
  font-weight: 800;
}

.plan-meta {
  color: var(--muted-2);
  font-size: 13px;
}

.plan-card .button {
  width: 100%;
}

.account-card {
  min-height: 148px;
  padding: 18px;
  border: 1px solid #cde3df;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
}

.account-card h3,
.account-card p {
  margin: 0;
}

.account-card h3 {
  font-size: 16px;
}

.account-card > div > p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
  padding: 5px;
  border: 1px solid #cde3df;
  border-radius: 12px;
  background: #eef8f6;
}

.auth-mode-option {
  display: grid;
  min-height: 52px;
  padding: 7px 14px;
  cursor: pointer;
  color: #52676c;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  line-height: 1.2;
  text-align: center;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.auth-mode-option span {
  font-size: 15px;
  font-weight: 800;
}

.auth-mode-option small {
  margin-top: 3px;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
}

.auth-mode-option:hover:not(:disabled):not(.is-active) {
  color: var(--teal-700);
  background: rgba(255, 255, 255, 0.62);
}

.auth-mode-option.is-active {
  color: var(--teal-700);
  border-color: #b8ddd7;
  background: #fff;
  box-shadow: 0 3px 10px rgba(21, 83, 76, 0.09);
}

.auth-mode-option:focus-visible {
  outline: 3px solid rgba(18, 151, 127, 0.2);
  outline-offset: 2px;
}

.auth-mode-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.auth-mode-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 13px;
}

.auth-mode-copy strong {
  color: var(--ink);
  font-size: 14px;
}

.auth-mode-copy span {
  color: var(--muted-2);
  font-size: 12px;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin-top: 9px;
}

.auth-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.auth-field label,
.admin-activation label {
  color: #395057;
  font-size: 12px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfdfd;
}

.auth-form input:focus {
  border-color: var(--teal-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.1);
}

.auth-actions {
  display: flex;
  align-items: stretch;
}

.auth-actions .button {
  min-height: 40px;
  min-width: 132px;
}

.admin-activation {
  grid-column: 1 / -1;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px dashed #bddbd6;
  border-radius: var(--radius-sm);
  background: #f6fbfa;
  font-size: 12px;
}

.admin-activation[hidden] {
  display: none;
}

.admin-activation summary {
  width: fit-content;
  cursor: pointer;
  color: var(--teal-700);
  font-weight: 700;
}

.admin-activation[open] summary {
  margin-bottom: 9px;
}

.admin-activation-content {
  display: grid;
  gap: 6px;
}

.admin-activation-content p {
  margin: 0;
  color: var(--muted-2);
}

.admin-activation-content input {
  max-width: 440px;
}

.auth-message {
  min-height: 18px;
  margin-top: 9px !important;
  color: var(--muted-2) !important;
}

.auth-message.is-error {
  color: var(--red-500) !important;
}

.auth-message.is-success {
  color: #0b7a55 !important;
}

.account-profile {
  min-height: 110px;
  align-items: center;
  gap: 14px;
}

.account-profile:not([hidden]) {
  display: flex;
}

.account-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--teal-600);
  font-family: Georgia, serif;
  font-weight: 700;
}

.account-profile-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.account-label,
.account-role {
  color: var(--muted-2);
  font-size: 12px;
}

.account-profile-copy strong {
  overflow: hidden;
  color: #173e3d;
  font-size: 18px;
  text-overflow: ellipsis;
}

.personal-api-card:not([hidden]) {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #b9ddd6;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(240, 250, 248, 0.96), rgba(255, 255, 255, 0.98));
}

.personal-api-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.personal-api-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted-2);
  font-size: 12px;
}

.personal-api-summary > span:first-child {
  color: #395057;
  font-weight: 800;
}

.personal-api-summary strong {
  color: var(--teal-700);
}

#personal-api-summary-hint {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.personal-api-content:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(360px, 1.2fr);
  gap: 22px;
  padding-top: 16px;
  border-top: 1px solid #d7e9e5;
}

.personal-api-copy h3,
.personal-api-copy p {
  margin: 0;
}

.personal-api-copy h3 {
  margin-top: 4px;
  color: #173e3d;
  font-size: 18px;
}

.personal-api-copy p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.official-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.official-link:hover {
  text-decoration: underline;
}

.personal-api-form {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.personal-api-form > label {
  color: #395057;
  font-size: 12px;
  font-weight: 800;
}

.personal-api-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.personal-api-controls input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font: 13px ui-monospace, SFMono-Regular, Consolas, monospace;
}

.personal-api-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted-2);
  font-size: 12px;
}

.personal-api-status strong {
  color: var(--teal-700);
}

.personal-api-hint {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.personal-api-message,
.personal-api-security {
  min-height: 0;
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.55;
}

.personal-api-message:empty {
  display: none;
}

.personal-api-message.is-error {
  color: var(--red-500);
}

.personal-api-message.is-success {
  color: #0b7a55;
}

.api-onboarding-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: 560px;
  margin: auto;
  padding: 26px;
  color: var(--ink);
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(25, 57, 62, 0.28);
}

.api-onboarding-dialog::backdrop {
  background: rgba(18, 42, 46, 0.58);
  backdrop-filter: blur(3px);
}

.api-onboarding-dialog[open] {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  animation: dialog-in 170ms ease-out;
}

.api-onboarding-dialog[data-mode="required"] {
  border-top: 5px solid #d58a24;
}

.api-onboarding-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #fff;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal-600), #0b5d59);
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.24);
  font-family: Georgia, serif;
  font-weight: 800;
}

.api-onboarding-kicker {
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.api-onboarding-dialog[data-mode="required"] .api-onboarding-kicker {
  color: #9a5d0a;
}

.api-onboarding-dialog h2,
.api-onboarding-dialog > p {
  margin: 0;
}

.api-onboarding-dialog h2 {
  color: #173e3d;
  font-size: clamp(21px, 4vw, 27px);
  line-height: 1.25;
}

.api-onboarding-dialog > p {
  max-width: 470px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.api-onboarding-notice {
  display: grid;
  width: 100%;
  gap: 3px;
  margin-top: 5px;
  padding: 12px 14px;
  color: var(--muted);
  border: 1px solid #cfe5e1;
  border-radius: 11px;
  background: var(--teal-50);
  font-size: 12px;
  line-height: 1.5;
}

.api-onboarding-notice strong {
  color: var(--teal-700);
}

.api-onboarding-actions {
  display: flex;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 5px;
}

.api-onboarding-actions .button {
  min-height: 44px;
  justify-content: center;
}

.official-api-link {
  text-decoration: none;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.redeem-form {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 14px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #d8e9e6;
}

.redeem-form > label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.redeem-controls {
  display: flex;
  gap: 10px;
}

.redeem-controls input,
.wallet-actions input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.redeem-message {
  grid-column: 2;
  color: var(--muted-2);
  font-size: 12px;
}

.redeem-message.is-error {
  color: var(--red-500);
}

.redeem-message.is-success {
  color: #0b7a55;
}

.manual-payment,
.admin-payment,
.message-center {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #d8e9e6;
}

.message-center h3 {
  margin: 0;
  font-size: 15px;
}

.message-count {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  margin-left: 4px;
  padding: 1px 6px;
  color: #fff;
  border-radius: 999px;
  background: var(--teal-600);
  font-size: 11px;
}

.message-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.site-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.site-message.is-unread {
  border-color: #9fd5ca;
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.07);
}

.site-message h4,
.site-message p {
  margin: 0;
}

.site-message h4 {
  font-size: 14px;
}

.site-message p,
.site-message time {
  color: var(--muted);
  font-size: 12px;
}

.site-message-copy {
  display: grid;
  gap: 4px;
}

.voucher-delivery {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 3px;
}

.message-read-button {
  align-self: center;
  justify-self: end;
}

.voucher-code {
  padding: 7px 9px;
  color: #173e3d;
  border: 1px dashed #8ecfc1;
  border-radius: 7px;
  background: var(--teal-50);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.payment-heading,
.pending-claims-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.payment-heading h3,
.payment-heading p,
.pending-claims-header h4 {
  margin: 0;
}

.payment-heading h3 {
  font-size: 16px;
}

.payment-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.manual-badge {
  padding: 4px 9px;
  color: #8a5a12;
  border: 1px solid #f0c986;
  border-radius: 999px;
  background: var(--amber-50);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.payment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  margin-top: 14px;
}

.qr-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.qr-card {
  display: grid;
  place-items: center;
  align-content: start;
  gap: 9px;
  min-width: 0;
  min-height: 360px;
  padding: 14px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.qr-card.is-selected {
  border-color: #79c7b8;
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.09);
}

.qr-card-heading {
  display: grid;
  place-items: center;
  gap: 2px;
}

.qr-plan-name {
  display: inline-flex;
  padding: 3px 8px;
  color: var(--teal-700) !important;
  border-radius: 999px;
  background: var(--teal-50);
  font-size: 11px !important;
  font-weight: 800;
}

.qr-image-shell {
  display: grid;
  width: min(180px, 100%);
  place-items: center;
}

.qr-image-shell > * {
  grid-area: 1 / 1;
}

.qr-card img,
.qr-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted-2);
  border: 1px dashed var(--line-strong);
  background: #f8fbfa;
  font-size: 12px;
}

.qr-card strong {
  color: #173e3d;
  font-size: 26px;
  line-height: 1.1;
}

.qr-card span {
  color: var(--muted-2);
  font-size: 11px;
}

.qr-credit-count {
  font-size: 12px !important;
  font-weight: 700;
}

.qr-card-note {
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
}

.qr-card .button {
  align-self: end;
  width: 100%;
  margin-top: auto;
}

.qr-card.is-selected [data-select-payment-plan] {
  color: #fff;
  border-color: var(--teal-600);
  background: var(--teal-600);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.16);
}

.payment-form-heading {
  grid-column: 1 / -1;
  padding-bottom: 2px;
}

.payment-form-heading h4,
.payment-form-heading p {
  margin: 0;
}

.payment-form-heading h4 {
  color: var(--ink);
  font-size: 14px;
}

.payment-form-heading p {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11px;
}

.payment-claim-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-content: start;
  align-items: center;
  gap: 10px 12px;
}

.payment-claim-form label,
.qr-upload-form label {
  color: #395057;
  font-size: 12px;
  font-weight: 700;
}

.payment-claim-form input,
.payment-claim-form select,
.qr-upload-form input,
.qr-upload-form select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 11px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.payment-claim-form .button,
.payment-claim-form .payment-message {
  grid-column: 2;
}

.payment-message {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
}

.payment-message.is-error {
  color: var(--red-500);
}

.payment-message.is-success {
  color: #0b7a55;
}

.claim-history {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.claim-history-item,
.pending-claim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 12px;
}

.claim-status {
  flex: 0 0 auto;
  color: #8a5a12;
  font-weight: 800;
}

.claim-status.is-approved {
  color: #0b7a55;
}

.claim-status.is-rejected {
  color: var(--red-500);
}

.qr-upload-form {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.qr-upload-form .payment-message {
  grid-column: 2 / -1;
}

#qr-plan {
  grid-column: 2;
}

.qr-upload-form label[for="qr-file"] {
  grid-column: 1;
}

#qr-file {
  grid-column: 2;
}

#qr-upload-btn {
  grid-column: 3;
  grid-row: 2;
}

.pending-claims-header {
  margin-top: 18px;
}

.pending-claims {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.auto-review-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #d8e9e6;
}

.review-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: #8a5a12;
  border: 1px solid #f0c986;
  border-radius: 999px;
  background: var(--amber-50);
  font-size: 11px;
  font-weight: 800;
}

.review-status.is-ready {
  color: #0b6b51;
  border-color: #9fd5ca;
  background: var(--teal-50);
}

.review-settings-form,
.bill-import-form {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.review-settings-form label,
.bill-import-form label {
  color: #395057;
  font-size: 12px;
  font-weight: 700;
}

.review-settings-form input,
.bill-import-form input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.review-settings-form .button,
.review-settings-form .payment-message,
.bill-import-form .payment-message {
  grid-column: 2 / -1;
}

.bill-import-form .button {
  grid-column: 3;
  grid-row: 1;
}

.money-input {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.money-input span {
  padding-left: 11px;
  font-size: 13px;
}

.money-input input {
  border: 0;
  box-shadow: none;
}

.import-history {
  display: grid;
  gap: 5px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.import-history > strong {
  color: #395057;
}

.import-history-item {
  padding: 7px 10px;
  border-left: 3px solid #9fd5ca;
  background: rgba(255, 255, 255, 0.72);
}

.risk-header {
  margin-top: 17px;
}

.risk-alerts {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.risk-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5bf7c;
  border-left: 4px solid #d89424;
  border-radius: 9px;
  background: #fffaf0;
}

.risk-alert.severity-critical {
  border-color: #e8aaaa;
  border-left-color: var(--red-500);
  background: #fff6f6;
}

.risk-alert.is-acknowledged {
  opacity: 0.66;
  border-color: var(--line);
  border-left-color: var(--line-strong);
  background: #fafcfc;
}

.risk-alert-copy {
  display: grid;
  gap: 3px;
}

.risk-alert h5,
.risk-alert p {
  margin: 0;
}

.risk-alert h5 {
  font-size: 13px;
}

.risk-alert p,
.risk-alert-copy span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.risk-alert-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.pending-claim-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pending-claim-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.wallet-tools {
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 13px;
}

.wallet-tools summary {
  width: fit-content;
  cursor: pointer;
  color: #0f766e;
  font-weight: 700;
}

.wallet-tools p {
  margin: 10px 0;
}

.wallet-actions {
  display: flex;
  gap: 10px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 2px 0 0;
  color: #20383e;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.eyebrow {
  display: block;
  color: var(--teal-600);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hint {
  color: var(--muted-2);
  font-size: 12px;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.turnstile-row {
  grid-column: 1 / -1;
  display: flex;
  min-height: 38px;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding-top: 2px;
}

.turnstile-widget {
  width: min(100%, 300px);
  min-height: 36px;
}

.turnstile-status {
  color: var(--muted-2);
  font-size: 12px;
}

.turnstile-status.is-ready {
  color: var(--teal-700);
  font-weight: 700;
}

.turnstile-status.is-error {
  color: var(--red-500);
}

.lookup-form input,
.document-meta > input {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: #fbfdfd;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.lookup-form input:hover,
.document-meta > input:hover,
.lookup-form input:focus,
.document-meta > input:focus {
  border-color: var(--teal-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.1);
}

.lookup-form input::placeholder,
.document-meta > input::placeholder {
  color: #9baaae;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 130ms ease, background 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: var(--teal-600);
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.2);
}

.button-primary:hover:not(:disabled) {
  background: var(--teal-700);
  box-shadow: 0 7px 15px rgba(15, 118, 110, 0.24);
}

.button-secondary {
  color: var(--teal-700);
  border-color: var(--teal-100);
  background: var(--teal-50);
}

.button-secondary:hover:not(:disabled) {
  border-color: #b9e5db;
  background: #e1f7f1;
}

.button-ghost {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

.button-ghost:hover:not(:disabled) {
  color: var(--red-500);
  border-color: #efcaca;
  background: var(--red-50);
}

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.is-loading .button-spinner {
  display: block;
}

.button.is-loading .button-label {
  opacity: 0.78;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.privacy-note,
.table-note {
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

.inline-message {
  min-height: 19px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-message.is-error {
  color: var(--red-500);
}

.inline-message.is-success {
  color: var(--teal-700);
}

.results-panel:has(.results-list:not([hidden])) {
  box-shadow: var(--shadow-md);
}

.empty-state {
  display: grid;
  min-height: 138px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted-2);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfdfd;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.empty-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--teal-600);
  font-size: 26px;
  border-radius: 50%;
  background: var(--teal-50);
}

.results-list {
  display: grid;
  gap: 11px;
}

.history-intro,
.pdf-backup-intro {
  margin: -3px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.history-summary {
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

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

.history-heading-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.history-collapse-hint {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--teal-700);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.history-collapse-hint::before {
  content: "展开历史";
}

.history-panel[open] .history-summary {
  margin-bottom: 18px;
}

.history-panel[open] .history-collapse-hint::before {
  content: "收起历史";
}

.history-panel-toolbar {
  position: sticky;
  z-index: 8;
  top: max(8px, env(safe-area-inset-top));
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 10px;
  pointer-events: none;
}

.history-collapse-button {
  min-height: 38px;
  pointer-events: auto;
  box-shadow: 0 6px 18px rgba(20, 78, 72, 0.12);
}

.history-collapse-button span {
  font-size: 17px;
  line-height: 1;
}

.history-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 9px;
  margin-bottom: 8px;
}

.history-search-form input {
  min-width: 0;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfefe;
}

.history-item-main {
  min-width: 0;
}

.history-wordline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.history-wordline strong {
  color: #173e3d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.history-wordline time,
.history-spelling {
  color: var(--muted-2);
  font-size: 11px;
}

.history-meaning {
  overflow-wrap: anywhere;
  color: #304a4f;
  font-size: 13px;
  white-space: normal;
}

.history-meaning strong {
  color: #173e3d;
  font-weight: 800;
}

.history-spelling {
  margin-top: 5px;
}

.history-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.history-empty {
  min-height: 108px;
  margin-top: 10px;
}

.pdf-backup-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.pdf-backup-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.pdf-backup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #fcfefe 0%, #f5fbfa 100%);
}

.pdf-backup-file {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pdf-backup-icon {
  display: grid;
  width: 42px;
  height: 48px;
  place-items: center;
  color: #fff;
  border-radius: 8px 8px 8px 3px;
  background: #b64a45;
  box-shadow: 0 5px 12px rgba(157, 53, 49, 0.17);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.pdf-backup-copy {
  min-width: 0;
}

.pdf-backup-titleline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pdf-backup-titleline strong {
  min-width: 0;
  overflow: hidden;
  color: #173e3d;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-backup-titleline time,
.pdf-backup-filename {
  color: var(--muted-2);
  font-size: 11px;
}

.pdf-backup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.pdf-backup-meta span {
  padding: 3px 8px;
  color: #315a57;
  border: 1px solid #cce5e0;
  border-radius: 999px;
  background: #edf8f6;
  font-size: 11px;
  font-weight: 700;
}

.pdf-backup-filename {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-backup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.pdf-backup-empty {
  min-height: 108px;
  margin-top: 10px;
}

.muted-text {
  color: var(--muted-2);
}

.result-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fcfefe;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.result-card:hover {
  border-color: #abd9d0;
  box-shadow: 0 5px 16px rgba(20, 45, 49, 0.06);
}

.result-main {
  min-width: 0;
}

.result-wordline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.result-word-input,
.result-pos-input {
  min-width: 0;
  padding: 2px 5px;
  color: #173e3d;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: transparent;
}

.result-word-input {
  width: min(280px, 100%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
}

.result-pos-input {
  width: 100px;
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--teal-100);
}

.result-word-input:hover,
.result-pos-input:hover,
.result-word-input:focus,
.result-pos-input:focus {
  border-color: #abd9d0;
  background: #fff;
}

.result-meaning-label {
  margin: 5px 0 5px;
  color: var(--muted-2);
  font-size: 11px;
}

.result-word {
  color: #173e3d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
}

.result-pronunciation {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.result-pos {
  padding: 2px 8px;
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--teal-100);
}

.result-example {
  margin: 9px 0 0;
  padding-left: 10px;
  color: var(--muted);
  font-size: 12px;
  border-left: 2px solid var(--teal-100);
}

.result-example:empty {
  display: none;
}

.result-card .rich-editor {
  min-height: 58px;
}

.result-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.rich-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
}

.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 32px;
  padding: 3px 5px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.rich-toolbar button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
}

.rich-toolbar button:hover,
.rich-toolbar button.is-active {
  color: var(--teal-700);
  background: var(--teal-100);
}

.rich-editor {
  min-height: 76px;
  max-height: 230px;
  overflow: auto;
  padding: 9px 11px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.rich-editor-shell-compact .rich-editor {
  min-height: 54px;
  max-height: 190px;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #a0adaf;
  pointer-events: none;
}

.rich-editor strong,
.rich-editor b {
  color: #173e3d;
  font-weight: 800;
}

.document-meta {
  display: grid;
  grid-template-columns: auto minmax(200px, 360px) 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.print-only-document-meta {
  display: none;
}

.document-meta label {
  color: #395057;
  font-size: 13px;
  font-weight: 700;
}

.document-meta > input {
  min-height: 38px;
}

.output-style-picker {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}

.output-style-picker legend {
  margin-bottom: 8px;
  padding: 0;
  color: #395057;
  font-size: 13px;
  font-weight: 700;
}

.output-style-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.output-style-option {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  cursor: pointer;
  font-weight: 400;
}

.output-style-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.output-style-option span {
  display: flex;
  width: 100%;
  min-height: 66px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: #fbfdfd;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.output-style-option strong {
  font-size: 13px;
}

.output-style-option small {
  overflow-wrap: anywhere;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.45;
}

.output-style-option:hover span {
  border-color: var(--teal-500);
  background: #fff;
}

.output-style-option input:focus-visible + span {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.14);
}

.output-style-option input:checked + span {
  border-color: var(--teal-600);
  background: var(--teal-100);
  box-shadow: inset 0 0 0 1px var(--teal-600);
}

.output-style-picker p {
  margin: 7px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
}

.output-order-picker {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}

.output-order-picker legend {
  margin-bottom: 8px;
  padding: 0;
  color: #395057;
  font-size: 13px;
  font-weight: 700;
}

.output-order-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.output-order-option {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  cursor: pointer;
  font-weight: 400;
}

.output-order-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.output-order-option span {
  display: flex;
  width: 100%;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: #fbfdfd;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.output-order-option strong {
  font-size: 13px;
}

.output-order-option small {
  color: var(--muted-2);
  font-size: 11px;
}

.output-order-option:hover span {
  border-color: var(--teal-500);
  background: #fff;
}

.output-order-option input:focus-visible + span {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.14);
}

.output-order-option input:checked + span {
  border-color: var(--teal-600);
  background: var(--teal-100);
  box-shadow: inset 0 0 0 1px var(--teal-600);
}

.output-order-picker p {
  margin: 7px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
}

.meta-help {
  color: var(--muted-2);
  font-size: 12px;
}

.wordbook-heading {
  align-items: center;
}

.wordbook-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.pdf-download-message {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: -2px 0 14px;
  padding: 11px 13px;
  color: #234e49;
  border: 1px solid #a9d9d0;
  border-radius: 10px;
  background: #edf8f6;
  font-size: 13px;
  line-height: 1.5;
}

.pdf-download-link {
  color: var(--teal-700);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.wordbook-preview-open {
  overflow: hidden;
}

.wordbook-preview-overlay {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #dce8e7;
}

.wordbook-preview-toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 56, 55, 0.12);
}

.wordbook-preview-toolbar > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordbook-preview-status {
  color: var(--muted);
  font-size: 12px;
}

.wordbook-preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.wordbook-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #dce8e7;
}

@media (max-width: 760px) {
  .wordbook-preview-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .wordbook-preview-status {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
  }

  .wordbook-preview-actions {
    grid-column: 2;
  }

  .wordbook-preview-actions .button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
  }
}

.pdf-download-link:hover,
.pdf-download-link:focus-visible {
  color: var(--teal-900);
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}

.table-scroll-hint {
  display: none;
  align-items: center;
  gap: 7px;
  margin: -4px 0 10px;
  color: var(--muted-2);
  font-size: 12px;
}

.table-scroll-hint span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  flex: 0 0 24px;
  color: var(--teal-700);
  border-radius: 999px;
  background: var(--teal-50);
  font-weight: 800;
}

.wordbook-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.wordbook-table col.col-word {
  width: 21%;
}

.wordbook-table col.col-cn-spelling,
.wordbook-table col.col-en-spelling {
  width: 18%;
}

.wordbook-table col.col-meaning {
  width: 35%;
}

.wordbook-table col.col-actions {
  width: 48px;
}

.wordbook-table th {
  height: 42px;
  padding: 8px 11px;
  color: #31545a;
  background: #eef8f5;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}

.wordbook-table th:first-child {
  border-top-left-radius: 11px;
}

.wordbook-table th:last-child {
  border-top-right-radius: 11px;
}

.wordbook-table td {
  position: relative;
  min-height: 64px;
  padding: 10px 11px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.wordbook-table tbody tr:last-child td {
  border-bottom: 0;
}

.wordbook-table tbody tr:hover td {
  background: #fbfefd;
}

.editable-cell {
  min-height: 38px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
}

.editable-cell:hover {
  border-color: var(--line);
  background: #fbfdfd;
}

.editable-cell:focus {
  border-color: #8ecfc1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 151, 127, 0.1);
}

.word-cell {
  color: #173e3d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
}

.spelling-cell {
  color: #4d6469;
}

.meaning-cell {
  line-height: 1.65;
}

.meaning-cell strong,
.meaning-cell b {
  color: #173e3d;
  font-weight: 800;
}

.row-actions {
  display: flex;
  justify-content: center;
  padding-top: 7px;
}

.icon-button {
  display: inline-grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--muted-2);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 16px;
}

.icon-button:hover {
  color: var(--red-500);
  border-color: #efcaca;
  background: var(--red-50);
}

.table-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted-2);
  text-align: center;
}

.table-empty > span {
  color: var(--teal-600);
  font-size: 25px;
  font-weight: 300;
}

.table-empty p {
  margin: 0;
  font-size: 13px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 15px;
  padding: 0 3px;
  color: var(--muted-2);
  font-size: 11px;
}

.app-footer-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
}

.icp-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.icp-link:hover,
.icp-link:focus-visible {
  color: var(--accent-strong, #0f766e);
  text-decoration: underline;
}

.toast-region {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  padding: 11px 14px;
  color: #fff;
  border-radius: 9px;
  background: rgba(30, 56, 62, 0.94);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  background: rgba(156, 53, 53, 0.96);
}

.toast.is-success {
  background: rgba(12, 98, 93, 0.96);
}

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

@media screen and (max-width: 1080px) {
  .app-shell {
    width: min(100% - 28px, 1320px);
  }

  .site-intro-hero {
    grid-template-columns: 1fr;
  }

  .site-intro-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .personal-api-content:not([hidden]) {
    grid-template-columns: 1fr;
  }

  .document-meta {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .meta-help,
  .output-style-picker,
  .output-order-picker {
    grid-column: 1 / -1;
  }

  .wordbook-table {
    min-width: 760px;
  }

  .table-scroll-hint {
    display: flex;
  }
}

@media screen and (max-width: 900px) {
  .billing-layout {
    grid-template-columns: 1fr;
  }

  .balance-card {
    min-height: 112px;
  }

  .auth-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-actions,
  .admin-activation {
    grid-column: 1 / -1;
  }

  .auth-actions .button {
    width: 100%;
  }
}

@media screen and (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1320px);
    padding-top: 14px;
  }

  .app-header,
  .section-heading,
  .wordbook-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-status {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    white-space: normal;
  }

  .site-intro-hero {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .site-intro-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-intro-features,
  .usage-flow-grid,
  .deepseek-steps,
  .troubleshooting-grid {
    grid-template-columns: 1fr;
  }

  .billing-summary-meta {
    width: 100%;
    justify-content: space-between;
  }

  .billing-layout {
    grid-template-columns: 1fr;
  }

  .personal-api-content:not([hidden]) {
    grid-template-columns: 1fr;
  }

  .balance-card {
    min-height: 132px;
  }

  .auth-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-actions,
  .admin-activation {
    grid-column: 1 / -1;
  }

  .auth-actions .button {
    width: 100%;
  }

  .redeem-form {
    grid-template-columns: 1fr;
  }

  .redeem-message {
    grid-column: 1;
  }

  .payment-layout,
  .payment-claim-form,
  .qr-upload-form,
  .review-settings-form,
  .bill-import-form {
    grid-template-columns: 1fr;
  }

  .payment-claim-form .button,
  .payment-claim-form .payment-message,
  .qr-upload-form .payment-message {
    grid-column: 1;
  }

  #qr-plan,
  .qr-upload-form label[for="qr-file"],
  #qr-file,
  #qr-upload-btn {
    grid-column: 1;
    grid-row: auto;
  }

  .review-settings-form .button,
  .review-settings-form .payment-message,
  .bill-import-form .button,
  .bill-import-form .payment-message {
    grid-column: 1;
    grid-row: auto;
  }

  .risk-alert {
    grid-template-columns: 1fr;
  }

  .risk-alert-actions {
    flex-wrap: wrap;
  }

  .qr-card {
    min-height: 230px;
  }

  .wallet-actions {
    flex-wrap: wrap;
  }

  .wallet-actions input {
    flex-basis: 100%;
  }

  .lookup-form {
    grid-template-columns: 1fr 1fr;
  }

  .lookup-form input {
    grid-column: 1 / -1;
  }

  .lookup-form button {
    width: 100%;
  }

  .turnstile-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .result-actions {
    justify-content: flex-start;
  }

  .history-search-form,
  .history-item,
  .pdf-backup-item {
    grid-template-columns: 1fr;
  }

  .history-collapse-button {
    min-height: 42px;
    padding-inline: 15px;
  }

  .history-item-actions,
  .pdf-backup-actions {
    justify-content: flex-start;
  }

  .pdf-backup-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .document-meta {
    grid-template-columns: 1fr;
  }

  .document-meta > input {
    width: 100%;
  }

  .output-style-options,
  .output-order-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wordbook-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .wordbook-actions .button {
    flex: 1 1 145px;
  }

  .app-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media screen and (max-width: 640px) {
  .app-shell {
    width: min(100% - 16px, 1320px);
    padding-top: 12px;
  }

  .app-main {
    gap: 13px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .app-header {
    gap: 13px;
    margin-bottom: 14px;
  }

  .brand-mark {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    border-radius: 12px;
    font-size: 20px;
  }

  .brand-lockup h1 {
    font-size: clamp(20px, 7vw, 24px);
  }

  .brand-lockup p {
    font-size: 12px;
  }

  .button {
    min-height: 44px;
  }

  .output-style-options,
  .output-order-options {
    grid-template-columns: 1fr;
  }

  .output-style-option span,
  .output-order-option span {
    min-height: 58px;
  }

  .personal-api-controls {
    grid-template-columns: 1fr;
  }

  .personal-api-controls .button {
    width: 100%;
  }

  .history-wordline,
  .pdf-backup-titleline {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .pdf-backup-file {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .pdf-backup-icon {
    width: 36px;
    height: 42px;
  }

  .wordbook-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wordbook-actions .button {
    width: 100%;
  }

  #clear-all-btn {
    grid-column: 1 / -1;
  }

  .table-scroll-hint {
    display: none;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .wordbook-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .wordbook-table colgroup,
  .wordbook-table thead {
    display: none;
  }

  .wordbook-table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  .wordbook-table tbody tr {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(20, 45, 49, 0.05);
  }

  .wordbook-table td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    min-height: 0;
    align-items: start;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .wordbook-table td::before {
    padding-top: 8px;
    content: attr(data-label);
    color: #49666b;
    font-size: 11px;
    font-weight: 800;
  }

  .wordbook-table tbody tr:last-child td:not(:last-child) {
    border-bottom: 1px solid var(--line);
  }

  .wordbook-table td:last-child,
  .wordbook-table tbody tr:last-child td:last-child {
    border-bottom: 0;
  }

  .wordbook-table td.actions-cell {
    display: block;
    padding: 8px 10px;
    background: #f8fbfa;
  }

  .wordbook-table td.actions-cell::before {
    display: none;
  }

  .wordbook-table .editable-cell,
  .wordbook-table .rich-editor-shell {
    width: 100%;
    min-width: 0;
  }

  .wordbook-table .editable-cell {
    min-height: 42px;
    padding: 8px 9px;
    border-color: var(--line);
    background: #fbfdfd;
  }

  .wordbook-table .rich-editor-shell-compact .rich-editor {
    min-height: 72px;
  }

  .row-actions {
    justify-content: flex-end;
    padding-top: 0;
  }

  .icon-button {
    display: inline-flex;
    width: auto;
    min-height: 40px;
    align-items: center;
    gap: 4px;
    padding: 7px 10px;
    color: var(--red-500);
    border-color: #efd4d2;
    background: var(--red-50);
    font-size: 18px;
  }

  .icon-button::after {
    content: "删除此条";
    font-size: 12px;
    font-weight: 700;
  }

  .result-word-input,
  .result-pos-input {
    max-width: 100%;
  }

  .api-onboarding-dialog {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

@media screen and (max-width: 520px) {
  .site-intro-actions {
    grid-template-columns: 1fr;
  }

  .lookup-form {
    grid-template-columns: 1fr;
  }

  .lookup-form input {
    grid-column: 1;
  }

  .lookup-form button {
    width: 100%;
  }

  .pdf-backup-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pdf-backup-heading-actions .button {
    width: 100%;
  }
}

@media screen and (max-width: 430px) {
  .app-shell {
    width: min(100% - 16px, 1320px);
  }

  .panel {
    padding: 16px;
  }

  .site-intro-actions {
    grid-template-columns: 1fr;
  }

  .deepseek-api-emphasis {
    align-items: flex-start;
  }

  .deepseek-setup-guide > summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .lookup-form {
    gap: 8px;
  }

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

  .qr-plan-grid {
    grid-template-columns: 1fr;
  }

  .redeem-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .personal-api-controls {
    grid-template-columns: 1fr;
  }

  .personal-api-toolbar {
    align-items: flex-start;
  }

  .api-onboarding-dialog {
    padding: 22px 17px;
  }

  .api-onboarding-actions {
    display: grid;
  }

  .api-onboarding-actions .button {
    width: 100%;
  }

  .auth-mode-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .account-profile:not([hidden]) {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .payment-heading,
  .pending-claim {
    align-items: flex-start;
    flex-direction: column;
  }

  .wordbook-actions .button {
    flex-basis: 100%;
  }
}

@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;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {

  body {
    background: #fff;
  }

  /* The PDF module normally prints from its own iframe.  These rules keep
     the browser's native print fallback from clipping a wide or multi-page
     table inside the screen-only scroll container. */
  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .app-header,
  .site-intro-panel,
  .billing-panel,
  .lookup-panel,
  .results-panel,
  .history-panel,
  .pdf-backup-panel,
  .wordbook-heading,
  .wordbook-actions,
  .document-meta,
  .table-note,
  .app-footer,
  .row-actions,
  .col-actions,
  .toast-region {
    display: none !important;
  }

  .print-only-document-meta {
    display: block;
    height: 23mm;
    padding-top: 2mm;
    color: #111;
  }

  .print-only-document-meta h1 {
    min-height: 9mm;
    margin: 0 0 3mm;
    overflow-wrap: anywhere;
    font-size: 19pt;
    line-height: 1.15;
    text-align: center;
  }

  .panel.wordbook-panel {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .wordbook-table {
    width: 100%;
    min-width: 0;
    height: auto;
    box-sizing: border-box;
    table-layout: fixed;
    border-collapse: collapse;
    border: 0.35mm solid #999;
  }

  /* The screen table reserves a narrow fifth column for delete controls.
     That column is hidden above, so rebalance the four printable columns to
     use the full A4 content width in the native-print fallback. */
  .wordbook-table col.col-word { width: 25.25%; }
  .wordbook-table col.col-cn-spelling,
  .wordbook-table col.col-en-spelling { width: 18.95%; }
  .wordbook-table col.col-meaning { width: 36.85%; }

  .wordbook-table thead {
    display: table-header-group;
  }

  .wordbook-table col.col-actions,
  .wordbook-table th.actions-heading,
  .wordbook-table td.actions-cell {
    display: none !important;
  }

  .wordbook-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .wordbook-table th,
  .wordbook-table td {
    border-color: #999;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
  }

  /* The screen table uses the wrapper's border and removes the last cell
     separator.  In native print the wrapper border is intentionally removed,
     so restore a real bottom edge on the last written row. */
  .wordbook-table tbody tr:last-child td {
    border-bottom: 0.25mm solid #999;
  }

  /* Native print is a backup path when the dedicated PDF iframe cannot be
     loaded.  Do not print editing chrome or a scroll-constrained editor in
     that route. */
  .rich-toolbar {
    display: none !important;
  }

  .rich-editor-shell {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .rich-editor {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .editable-cell {
    padding: 0;
  }
}
