:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1d26;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --pay: #059669;
  --pay-hover: #047857;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.wrap {
  width: min(1400px, 98vw);
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.unit-pt {
  color: var(--muted);
  font-size: 0.8em;
  white-space: nowrap;
}

.tabs {
  display: flex;
  width: 100%;
  gap: 0.5rem;
  background: var(--card);
  padding: 0.35rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem 1.75rem;
}

.card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.hint {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint code {
  font-size: 0.85em;
  background: #f3f4f6;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 110px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.file-drop:hover {
  border-color: var(--primary);
  background: #f8faff;
}

.file-drop.dragover {
  border-color: var(--primary);
  background: #eff6ff;
  border-style: solid;
}

.file-drop input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.file-label {
  color: var(--primary);
  font-weight: 500;
}

.file-name {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
}


.opt-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  cursor: pointer;
  user-select: none;
}

.opt-check input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.opt-check-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.opt-check-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.opt-check-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.pay {
  background: var(--pay);
  color: #fff;
}

.btn.pay:hover {
  background: var(--pay-hover);
}

.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #f3f4f6;
}

.status.loading {
  background: #eff6ff;
  color: #1e40af;
}

.status.error {
  background: #fef2f2;
  color: var(--danger);
}


.progress-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.progress {
  height: 8px;
  width: 100%;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

.result {
  margin-top: 1.25rem;
}

.meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.sizes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  width: 100%;
  align-items: start;
}

.sizes-grid.single-col {
  grid-template-columns: 1fr;
}

.sizes-grid .table-wrap {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.sizes-grid.single-col .table-wrap {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.sizes-mini {
  font-size: 0.84rem;
}

th.col-n,
td.col-n {
  width: 14%;
}

th.col-num,
td.col-num {
  width: 22%;
}

th.col-sheet,
td.col-sheet {
  width: 42%;
  text-align: center;
}

th,
td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--muted);
}

th.col-n,
td.col-n,
th.col-num,
td.col-num {
  text-align: center;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

th.col-sheet,
td.col-sheet {
  text-align: center;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #eef4ff;
}

tr:last-child td {
  border-bottom: none;
}



table.sizes-both {
  table-layout: auto;
  font-size: 0.8rem;
  min-width: 36rem;
}

table.sizes-both th,
table.sizes-both td {
  white-space: nowrap;
  text-align: center;
  width: auto;
}

td.trim-alert {
  color: #dc2626;
  font-weight: 600;
  background: #fef2f2;
}

tbody tr:hover td.trim-alert {
  background: #fee2e2;
}

.trim-note {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: #dc2626;
  font-weight: 600;
}


.wm-uploads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.file-drop-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.wm-layout {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}

.wm-layout legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.wm-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  margin-top: 0.35rem;
}

.wm-field {
  display: grid;
  grid-template-columns: minmax(6.5rem, 40%) 1fr;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.wm-label {
  text-align: right;
  color: var(--muted);
  font-weight: 500;
}

.wm-input {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wm-field input[type="number"],
.wm-field select {
  width: 100%;
  max-width: 9rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
}

.wm-unit {
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.fail-item {
  margin: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--danger);
}

@media (max-width: 720px) {
  .wm-uploads,
  .wm-layout-grid {
    grid-template-columns: 1fr;
  }
  .wm-field {
    grid-template-columns: minmax(5.5rem, 36%) 1fr;
  }
}

.sizes-download {
  margin-top: 1.25rem;
  display: flex;
  width: 100%;
}

.sizes-download .btn {
  width: 100%;
}
.done-msg {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.pay-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.badge {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .sizes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .tabs {
    border-radius: var(--radius);
    flex-direction: column;
  }

  .tab,
  .tab.active {
    border-radius: 8px;
  }

  th.col-n,
  td.col-n {
    width: 42px;
  }

  th.col-num,
  td.col-num {
    width: 58px;
  }
}

.btn.primary:disabled,
.btn.primary.is-disabled {
  background: #9ca3af;
  color: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.85;
}

.btn.primary:disabled:hover,
.btn.primary.is-disabled:hover {
  background: #9ca3af;
}

.margin-settings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}

.margin-mm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.margin-mm-label {
  font-weight: 600;
  min-width: 2.5rem;
}

.margin-mm-row input[type="number"] {
  width: 6rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
}

.margin-mm-unit {
  color: var(--muted);
  font-size: 0.9rem;
}

.margin-dirs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
}

.dir-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
}

.dir-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.thickness-fieldset {
  margin: 0.85rem 0 1rem;
}

.thickness-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-top: 0.35rem;
}

.dir-check input[type="radio"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}


.warn-red {
  color: #dc2626;
  font-weight: 600;
}


/* ---- accounts / billing (2026-09-26) ---- */
.wrap.narrow {
  width: min(900px, 98vw);
}

.userbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.userbar a,
.link-btn {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.userbar a:hover,
.link-btn:hover {
  text-decoration: underline;
}

.userbar strong {
  color: var(--text);
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.status.ok {
  background: #ecfdf5;
  color: #047857;
}

.flash {
  margin: 0 0 1rem;
  text-align: center;
}

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

.small {
  font-size: 0.82rem;
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-form input {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

.auth-alt {
  margin: 1rem 0 0;
  font-size: 0.88rem;
}

.auth-alt + .auth-alt {
  margin-top: 0.35rem;
}

.login-gate {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  background: #fafbfc;
}

.login-gate p {
  margin: 0 0 0.9rem;
}

.gate-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.quote-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.quote-box .done-msg {
  margin: 0;
}

.quote-box .status {
  margin-top: 0;
}

.balance-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  margin: 1rem 0;
}

.balance-num {
  font-size: 1.6rem;
  font-weight: 700;
}

.balance-box .btn {
  margin-left: auto;
}

.card h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.6rem;
}

.ledger-table td,
.ledger-table th,
.tier-table td,
.tier-table th {
  text-align: left;
  padding: 0.45rem 0.6rem;
}

.ref-cell {
  font-size: 0.78rem;
  word-break: break-all;
}

.delta-plus {
  color: var(--pay);
  font-weight: 600;
}

.delta-minus {
  color: var(--danger);
  font-weight: 600;
}

.buy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.buy-grid .btn {
  margin-top: 0.5rem;
}

.price-box {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}

.price-total {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.price-box .status {
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .buy-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- batch unlock (2026-09-26b) ---- */
.file-list,
.fail-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
}

.fail-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--danger);
}

.fail-list li {
  color: var(--danger);
}

/* ---- anti-abuse notes (2026-09-27a) ---- */
.status.warn {
  background: #fffbeb;
  color: #92400e;
}

/* ---- i18n + info pages (2026-09-28a) ---- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.sitenav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.sitenav a,
.lang-switch a,
.footer a {
  color: var(--primary);
  text-decoration: none;
}

.sitenav a:hover,
.lang-switch a:hover,
.footer a:hover {
  text-decoration: underline;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
}

.lang-switch strong {
  color: var(--text);
}

.subtitle.center {
  text-align: center;
  margin: -1rem 0 1.25rem;
}

.features {
  margin-bottom: 1.25rem;
}

.feature-list {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2.5rem;
  font-size: 0.9rem;
}

.feature-list li {
  line-height: 1.45;
  margin-bottom: 0.4rem;
  break-inside: avoid;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  vertical-align: 1px;
}

.tag.free {
  background: #ecfdf5;
  color: #047857;
}

.tag.paid {
  background: #eff6ff;
  color: #1d4ed8;
}

.tag.soon {
  background: #fff7ed;
  color: #c2410c;
}

/* PDF→DWF tab: badge always on its own line under the title */
.tab.tab-with-soon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}

.tab.tab-with-soon .tab-title {
  display: block;
  white-space: nowrap;
}

.tab-soon {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #c2410c;
  white-space: nowrap;
  line-height: 1.1;
}

.tab.tab-with-soon.active .tab-soon {
  color: #ffedd5;
}

/* Panel h2 only: badge on second line under title (features list stays inline) */
.title-with-soon {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.25;
}

.title-with-soon .title-text {
  display: block;
  white-space: nowrap;
}

.title-with-soon .tag.soon {
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

.coming-soon {
  margin: 0.75rem 0 0.25rem;
  padding: 0.85rem 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.doc {
  line-height: 1.7;
}

.doc h3 {
  margin-top: 1.4rem;
}

.doc ul {
  padding-left: 1.3rem;
}

.doc li {
  margin-bottom: 0.35rem;
}

.doc .table-wrap {
  margin-bottom: 0.75rem;
}

.contact-email {
  font-size: 1.3rem;
  font-weight: 600;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
}

@media (max-width: 720px) {
  .feature-list {
    columns: 1;
  }
}

.quote-box .warn-irreversible {
  color: #8a4b08;
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  margin: 0.75rem 0;
}
