:root {
  --ink: #2d2022;
  --muted: #7b6668;
  --line: #efd1d4;
  --paper: #ffffff;
  --wash: #fff6f6;
  --red: #e5323f;
  --red-strong: #c8212e;
  --red-soft: #ffe6e8;
  --rose: #f46d78;
  --gold: #bd7a10;
  --danger: #b42318;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fff1f2 0, #fff8f8 320px, #fff6f6 100%);
  padding-top: 70px;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 42px;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(239, 154, 162, 0.42);
  background: rgba(255, 247, 247, 0.88);
  box-shadow: 0 8px 24px rgba(167, 37, 49, 0.08);
  backdrop-filter: blur(18px);
}

.nav-brand {
  color: var(--red);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-link {
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notice-button,
.text-button,
.outline-button {
  border: 0;
  background: transparent;
  color: #6d4d51;
  cursor: pointer;
}

.notice-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #f0b5bc;
  color: #9a3d46;
  font-weight: 900;
}

.notice-button > span {
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

.notice-button small {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 10;
  display: none;
  width: 286px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(116, 32, 39, 0.14);
  padding: 12px;
  color: #5a4245;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
}

.notice-button:hover small,
.notice-button:focus-visible small {
  display: block;
}

.text-button {
  font-weight: 800;
}

.outline-button {
  height: 34px;
  border: 1px solid #ef9aa2;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--red);
  font-weight: 800;
}

.nav-link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5a3035;
  font-weight: 900;
}

.credit-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid #ef9aa2;
  border-radius: 999px;
  background: #fff;
  padding: 0 12px;
  color: var(--red);
  text-decoration: none;
  font-weight: 900;
}

.credit-pill small {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 10;
  display: none;
  width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(116, 32, 39, 0.14);
  padding: 10px;
  color: #5a4245;
  line-height: 1.55;
}

.credit-pill:hover small,
.credit-pill:focus-visible small {
  display: block;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: center;
  min-height: 150px;
  padding: 18px 0 10px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #665053;
  font-size: 18px;
  line-height: 1.75;
}

.issue-cloud {
  position: relative;
  min-height: 164px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 26% 34%, rgba(255, 215, 219, 0.8) 0 19%, transparent 20%),
    radial-gradient(circle at 72% 68%, rgba(255, 236, 192, 0.78) 0 16%, transparent 17%);
  overflow: hidden;
}

.issue-cloud span {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(244, 182, 189, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px 11px;
  color: #7b3038;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(213, 54, 68, 0.06);
  white-space: nowrap;
  animation: float-word 5.8s ease-in-out infinite;
}

.issue-cloud span:nth-child(1) { left: 18px; top: 18px; animation-delay: -0.3s; }
.issue-cloud span:nth-child(2) { right: 18px; top: 20px; animation-delay: -1.5s; }
.issue-cloud span:nth-child(3) { left: 28px; top: 70px; color: var(--red); animation-delay: -2.6s; }
.issue-cloud span:nth-child(4) { right: 34px; top: 68px; animation-delay: -3.4s; }
.issue-cloud span:nth-child(5) { left: 16px; bottom: 16px; animation-delay: -4.3s; }
.issue-cloud span:nth-child(6) { right: 14px; bottom: 15px; animation-delay: -5s; }
.issue-cloud span:nth-child(7) { left: 50%; bottom: 8px; transform: translateX(-50%); animation-name: float-word-bottom; animation-delay: -1.1s; }

@keyframes float-word {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}

@keyframes float-word-bottom {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-7px); }
}

.is-hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.45fr);
  gap: 16px;
  align-items: start;
}

.upload-panel,
.source-panel,
.report-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.upload-panel,
.source-panel {
  padding: 20px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2,
.report-preview h2 {
  margin-bottom: 6px;
  font-size: 22px;
  color: #4a181d;
}

.section-head p,
.report-preview p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 188px;
  margin-bottom: 18px;
  border: 1px dashed #ec9aa3;
  border-radius: 8px;
  background: #fffafa;
  cursor: pointer;
  text-align: center;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 24px;
  font-weight: 900;
}

.dropzone small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: #5d3d41;
  font-size: 14px;
  font-weight: 800;
}

select,
input[type="number"] {
  width: 100%;
  height: 42px;
  border: 1px solid #edc2c7;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 11px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  border: 1px solid #edc2c7;
  border-radius: 6px;
  background: #fff8f8;
  color: #6d4d51;
  cursor: pointer;
}

.toggle span {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 50%;
  background: #cfadb1;
}

.toggle.is-on {
  border-color: #ee8790;
  background: var(--red-soft);
  color: var(--red-strong);
  font-weight: 800;
}

.toggle.is-on span {
  background: var(--red);
}

.price-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.price-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffafa;
}

.price-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.price-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  color: #4a181d;
}

.primary-button {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--red-strong);
}

.primary-button:disabled,
.toggle:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.review-status {
  margin-top: 16px;
  border: 1px solid #efc5ca;
  border-radius: 8px;
  background: #fffafa;
  padding: 14px;
}

.review-status strong {
  display: block;
  margin-bottom: 5px;
  color: #5a2329;
}

.review-status p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.progress-wrap {
  margin-top: 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #6d4d51;
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f7d9dd;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width 260ms ease;
}

.review-status[data-tone="success"] {
  border-color: #e9a3aa;
  background: #fff5f5;
}

.review-status[data-tone="error"] {
  border-color: #e19a93;
  background: #fff7f6;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.result-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: 900;
}

.result-link.primary {
  background: var(--red);
  color: #fff;
}

.source-group h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #5a2329;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin-bottom: 9px;
  color: #5e4548;
  line-height: 1.55;
}

.flow-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.flow-step {
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--paper);
}

.flow-step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #ffe3e6;
  color: var(--red);
  font-weight: 900;
}

.flow-step.is-active {
  border-color: #ed9aa3;
}

.flow-step.is-active span {
  background: var(--red);
  color: white;
}

.flow-step strong {
  display: block;
  margin-bottom: 6px;
}

.flow-step p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.report-preview {
  padding: 20px;
}

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

.sample-grid figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
  aspect-ratio: 1.62;
}

.sample-grid img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(70, 22, 28, 0.38);
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  border-radius: 8px;
  background: white;
  padding: 24px;
  box-shadow: 0 22px 50px rgba(116, 32, 39, 0.2);
}

.auth-panel {
  width: min(460px, 100%);
}

.icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: #fff0f1;
  color: #7a333a;
  font-size: 22px;
  cursor: pointer;
}

.quota-summary {
  display: grid;
  gap: 5px;
  margin: 18px 0;
  border: 1px solid #edc2c7;
  border-radius: 8px;
  background: #fffafa;
  padding: 16px;
}

.quota-summary span,
.quota-summary small {
  color: var(--muted);
}

.quota-summary strong {
  color: #4a181d;
  font-size: 24px;
}

.auth-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.auth-form input,
.redeem-form input {
  width: 100%;
  height: 42px;
  border: 1px solid #edc2c7;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 11px;
}

.auth-switch {
  display: block;
  margin: 13px auto 0;
}

.account-shell {
  padding-top: 28px;
}

.nav-user {
  color: #5a3035;
  font-weight: 900;
}

.account-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.account-sidebar,
.account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.account-sidebar {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 10px;
}

.account-sidebar a,
.account-sidebar button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5d3d41;
  padding: 0 12px;
  text-align: left;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}

.account-sidebar a {
  display: flex;
  align-items: center;
}

.account-sidebar .is-active,
.account-sidebar a:hover,
.account-sidebar button:hover {
  background: var(--red-soft);
  color: var(--red-strong);
}

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

.account-card {
  padding: 22px;
}

.balance-card {
  display: grid;
  gap: 8px;
  border: 1px solid #efb6bd;
  border-radius: 8px;
  background: #fffafa;
  padding: 18px;
  margin-bottom: 16px;
}

.balance-card span {
  color: var(--muted);
  font-weight: 800;
}

.balance-card strong {
  color: var(--red);
  font-size: 36px;
}

.redeem-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.shop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.account-tip {
  margin: 12px 0 0;
  color: var(--muted);
}

.ledger-list {
  display: grid;
  gap: 10px;
}

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

.ledger-item strong,
.ledger-item span,
.ledger-item small,
.ledger-item b {
  display: block;
}

.ledger-item span,
.ledger-item small,
.empty-record {
  color: var(--muted);
}

.ledger-item b {
  text-align: right;
}

.ledger-item .is-plus {
  color: #16794c;
}

.ledger-item .is-minus {
  color: var(--red);
}

.profile-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-list div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.profile-list dt {
  color: var(--muted);
  font-weight: 900;
}

.profile-list dd {
  margin: 0;
  color: var(--ink);
}

.admin-form {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) minmax(180px, 1.2fr) 130px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.admin-form input {
  width: 100%;
  height: 42px;
  border: 1px solid #edc2c7;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 11px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}

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

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  color: #4f373a;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #fff7f7;
  color: #5a2329;
  font-size: 13px;
  font-weight: 900;
}

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

.admin-table code {
  color: var(--red-strong);
  font-weight: 900;
}

.mini-button {
  min-height: 32px;
  border: 1px solid #ef9aa2;
  border-radius: 6px;
  background: #fff;
  color: var(--red);
  padding: 0 10px;
  font-weight: 900;
  cursor: pointer;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.danger-button {
  border-color: #d45c52;
  color: #a83228;
  background: #fff7f6;
}

@media (max-width: 900px) {
  .topbar,
  .workspace,
  .account-layout,
  .redeem-grid,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .flow-band,
  .price-strip,
  .form-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 42px;
  }

  .issue-cloud {
    min-height: 190px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 16px;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .upload-panel,
  .source-panel,
  .report-preview {
    padding: 14px;
  }

  h1 {
    font-size: 36px;
  }

  .lead {
    font-size: 16px;
  }
}
