:root {
  --ink: #17342f;
  --muted: #657773;
  --paper: #f5f3ec;
  --surface: rgba(255, 255, 252, .92);
  --line: #dfe5df;
  --green: #176c59;
  --green-dark: #0d4f43;
  --green-soft: #dceee7;
  --gold: #d8973c;
  --red: #b54747;
  --red-soft: #f9e5e2;
  --shadow: 0 18px 55px rgba(28, 59, 50, .09);
  --radius: 22px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(circle at 10% 10%, #fffdf4 0, transparent 34%), var(--paper); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.ambient-one { width: 360px; height: 360px; top: 80px; right: -140px; background: rgba(110, 178, 148, .13); }
.ambient-two { width: 260px; height: 260px; bottom: -90px; left: -80px; background: rgba(216, 151, 60, .09); }
.site-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; min-height: 76px; padding: 12px clamp(20px, 5vw, 72px); border-bottom: 1px solid rgba(199, 209, 202, .7); background: rgba(248, 247, 241, .86); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--green-dark); font: 700 21px Georgia, serif; box-shadow: 0 8px 20px rgba(13, 79, 67, .22); }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.main-nav { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.64); }
.main-nav a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 650; }
.main-nav a:hover, .main-nav a.is-active { color: var(--green-dark); background: white; box-shadow: 0 3px 10px rgba(27, 66, 56, .08); }
.session-actions { justify-self: end; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .7fr); align-items: center; gap: clamp(48px, 8vw, 110px); min-height: calc(100vh - 190px); }
.auth-intro h1, .page-heading h1 { margin: 12px 0 14px; font-family: Georgia, "Songti SC", serif; font-weight: 600; letter-spacing: -.035em; }
.auth-intro h1 { max-width: 680px; font-size: clamp(44px, 6vw, 72px); line-height: 1.08; }
.auth-intro > p { max-width: 590px; color: var(--muted); font-size: 17px; line-height: 1.85; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.trust-note { display: flex; align-items: center; gap: 9px; margin-top: 30px; color: var(--green-dark); font-size: 14px; }
.trust-note span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--green-soft); }
.usage-guide { margin-top: 28px; max-width: 680px; padding: 20px 22px; border: 1px solid #e2c28e; border-radius: 16px; background: #fff8eb; color: #493d29; }
.usage-guide-heading { display: flex; align-items: flex-start; gap: 12px; }
.usage-guide-heading strong, .usage-guide-heading span { display: block; }
.usage-guide-heading strong { color: #5e461f; font-size: 15px; line-height: 1.5; }
.usage-guide-heading span { margin-top: 3px; color: #806b45; font-size: 13px; line-height: 1.6; }
.usage-guide-icon { display: grid; flex: 0 0 26px; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--gold); font-weight: 800; }
.usage-guide ol { display: grid; gap: 10px; margin: 18px 0 0; padding-left: 22px; }
.usage-guide li { padding-left: 4px; line-height: 1.55; }
.usage-guide li strong, .usage-guide li span { display: block; }
.usage-guide li strong { color: #5e461f; font-size: 14px; }
.usage-guide li span { color: #745f3c; font-size: 13px; }
.usage-guide-note { margin: 16px 0 0; padding-top: 13px; border-top: 1px solid #ecd7ad; color: #745019; font-size: 13px; line-height: 1.6; }
.panel { border: 1px solid rgba(216, 224, 218, .92); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.download-panel { max-width: 850px; margin: 0 auto; padding: clamp(24px, 5vw, 54px); }
.download-panel h1 { margin: 18px 0; font-size: clamp(28px, 4vw, 44px); }
.download-panel h2 { margin-top: 36px; font-size: 22px; }
.download-panel p { line-height: 1.8; }
.download-panel .button { padding: 14px 20px; text-align: center; }
.download-panel a:not(.button) { color: var(--green); text-decoration: underline; }
.download-steps { padding-left: 22px; line-height: 2; }
.download-startup { margin-top: 28px; padding: clamp(16px, 3vw, 24px); border: 1px solid #e2c28e; border-radius: 16px; background: #fff8eb; }
.download-startup h2 { margin: 0 0 16px; font-size: 21px; line-height: 1.5; }
.download-startup-summary { color: #745019; }
.download-startup-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.download-startup-images figure { margin: 0; min-width: 0; }
.download-startup-images figcaption { display: grid; gap: 6px; margin-bottom: 12px; line-height: 1.6; }
.download-startup-images figcaption span { color: var(--muted); font-size: 13px; }
.download-startup-images img { display: block; width: 100%; height: auto; border-radius: 8px; }
@media (max-width: 640px) { .download-startup-images { grid-template-columns: 1fr; } }
.auth-panel { padding: 10px 34px 34px; }
.tab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.tab { padding: 16px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; cursor: pointer; }
.tab.is-active { border-color: var(--green); color: var(--green-dark); font-weight: 700; }
.stack { display: grid; gap: 19px; }
.billing-modes { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 12px 0; border: 0; min-width: 0; }
.billing-modes legend { font-size: 13px; font-weight: 650; }
.billing-modes label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.billing-modes input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.stack h2 { margin: 0 0 5px; font-size: 25px; }
.muted { margin: 0; color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 8px; color: #294841; font-size: 13px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid #ccd7d0; border-radius: 12px; outline: 0; color: var(--ink); background: rgba(255,255,255,.9); transition: border .18s, box-shadow .18s; }
input { height: 45px; padding: 0 13px; }
textarea { min-height: 116px; padding: 12px 13px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,108,89,.12); }
input::placeholder, textarea::placeholder { color: #9ba8a4; }
.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(23,108,89,.18); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); }
.button-secondary { border-color: #c9d6cf; color: var(--green-dark); background: white; }
.button-ghost { border-color: transparent; color: var(--muted); background: transparent; }
.button-danger { border-color: #e9cbc7; color: var(--red); background: #fff8f6; }
.button-wide { width: 100%; margin-top: 2px; }
.button-small { min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 12px; }
.form-message { min-height: 18px; margin: -6px 0 0; font-size: 13px; }
.form-message.is-error { color: var(--red); }
.form-message.is-success { color: var(--green); }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { font-size: clamp(36px, 5vw, 54px); }
.status-pill, .badge { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.status-pill { padding: 8px 13px; font-size: 12px; }
.status-pill.is-enabled, .badge-enabled, .badge-success, .badge-succeeded, .badge-completed { color: #13634e; background: #dff2e9; }
.status-pill.is-disabled, .badge-disabled, .badge-failed { color: var(--red); background: var(--red-soft); }
.dashboard-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 20px; margin-bottom: 20px; }
.balance-card, .recharge-card { min-height: 190px; padding: 28px; }
.balance-card { color: white; background: linear-gradient(145deg, #164f45, #0e352f); border-color: transparent; }
.card-label { margin-bottom: 13px; color: inherit; font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; opacity: .74; }
.balance-value { display: block; margin: 4px 0 21px; font: 600 clamp(38px, 5vw, 57px) Georgia, serif; letter-spacing: -.04em; }
.balance-card p { margin: 0; color: rgba(255,255,255,.64); font-size: 13px; }
.recharge-card { display: grid; grid-template-columns: 1fr minmax(260px, .8fr); align-items: center; gap: 28px; }
.recharge-card h2 { margin: 0 0 6px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.money-input { position: relative; }
.money-input span { position: absolute; top: 12px; left: 13px; color: var(--muted); }
.money-input input { padding-left: 31px; }
.recharge-card .form-message { grid-column: 1 / -1; }
.data-panel { margin-top: 20px; padding: 26px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 4px; font-size: 21px; }
.section-heading p { font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 13px; color: var(--muted); background: #f3f6f3; text-align: left; font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
th:first-child { border-radius: 9px 0 0 9px; } th:last-child { border-radius: 0 9px 9px 0; }
td { max-width: 340px; padding: 15px 13px; border-bottom: 1px solid #edf0ed; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.amount-positive { color: var(--green); font-weight: 750; }
.amount-negative { color: var(--red); font-weight: 750; }
.mono { display: inline-block; max-width: 160px; overflow: hidden; color: #51645f; font-family: ui-monospace, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.badge { padding: 5px 9px; color: #53615e; background: #edf0ee; font-size: 11px; }
.badge-pending, .badge-processing { color: #80580f; background: #fbefcf; }
.badge-refunded { color: #476270; background: #e5eef2; }
.state-box { display: flex; min-height: 112px; align-items: center; justify-content: center; gap: 10px; border: 1px dashed #d7dfd9; border-radius: 14px; color: var(--muted); font-size: 13px; }
.state-box.loading::before { width: 17px; height: 17px; border: 2px solid #bfd3ca; border-top-color: var(--green); border-radius: 50%; content: ""; animation: spin .7s linear infinite; }
.error-state { flex-direction: column; color: var(--red); }
.error-state span { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.pagination { display: flex; min-height: 36px; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.page-label { color: var(--muted); font-size: 12px; }
.search-form { display: flex; gap: 8px; }
.search-form input { width: min(260px, 52vw); }
.user-cell { display: grid; gap: 4px; }
.user-cell small { max-width: 210px; overflow: hidden; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 10px; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; }
.notice { display: flex; gap: 8px; padding: 22px; }
.notice-error { color: var(--red); background: #fff9f7; }
.detail-panel { margin-top: 20px; padding: 26px; scroll-margin-top: 96px; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: #f0f3f0; font-size: 23px; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: minmax(260px, .55fr) 1.45fr; gap: 28px; }
.detail-grid h3, .detail-requests h3, .compact-form h3 { margin: 0 0 15px; font-size: 15px; }
.compact-form { align-content: start; padding: 19px; border-radius: 16px; background: #f3f6f3; }
.detail-requests { margin-top: 30px; }
.rubric-form { display: grid; grid-template-columns: minmax(180px, .45fr) 1.4fr auto; align-items: end; gap: 12px; margin-bottom: 24px; padding: 18px; border-radius: 15px; background: #f3f6f3; }
.rubric-form textarea { min-height: 86px; }
.rubric-form .form-message { grid-column: 1 / -1; }
.rubric-body { display: -webkit-box; overflow: hidden; margin: 0; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: pre-wrap; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 48px)); padding: 13px 17px; border-radius: 12px; color: white; background: var(--green-dark); box-shadow: 0 12px 34px rgba(17,51,43,.24); font-size: 13px; }
.toast.is-error { background: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 860px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { position: static; grid-column: 1 / -1; grid-row: 2; justify-content: center; background: rgba(255,255,255,.94); }
  .session-actions { grid-column: 2; grid-row: 1; }
  .main-nav a { flex: 1; text-align: center; }
  .auth-layout { grid-template-columns: 1fr; gap: 36px; padding-top: 10px; }
  .auth-intro h1 { font-size: 48px; }
  .auth-intro > p { font-size: 15px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .rubric-form { grid-template-columns: 1fr; align-items: stretch; }
  .page-shell { padding-bottom: 110px; }
}

@media (max-width: 580px) {
  .site-header { min-height: 66px; padding: 10px 16px; }
  .brand small, .session-actions > span { display: none; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .auth-intro h1 { font-size: 38px; }
  .auth-panel { padding: 8px 22px 26px; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading h1 { font-size: 39px; }
  .balance-card, .recharge-card, .data-panel, .detail-panel { padding: 21px; border-radius: 18px; }
  .recharge-card { grid-template-columns: 1fr; }
  .recharge-card .form-message { grid-column: 1; }
  .inline-form { grid-template-columns: 1fr; }
  .responsive-heading { flex-direction: column; }
  .search-form, .search-form input { width: 100%; }
  td { min-width: 110px; }
  .rubric-form { padding: 15px; }
  .pagination { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.card-form { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin: 20px 0; }
.card-form label { flex: 1; min-width: 160px; }
.card-form .form-message { flex-basis: 100%; }
.card-form[hidden] { display: none; }
select { width: 100%; padding: 12px; border: 1px solid #d6ded9; border-radius: 10px; background: white; color: inherit; font: inherit; }
#card-codes { width: 100%; font-family: monospace; }
.card-trace { min-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.card-trace p { margin: 5px 0; }
.admin-tabs { display: flex; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.7); }
.admin-tab { flex: 1; min-width: 0; padding: 13px 10px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; }
.admin-tab:hover { color: var(--green-dark); background: var(--green-soft); }
.admin-tab.is-active { color: white; background: var(--green-dark); box-shadow: 0 3px 10px rgba(27,66,56,.12); }
.admin-tab:focus-visible, .admin-tab-panel:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
#pricing-form { max-width: 480px; }
#pricing-form input { min-width: 0; }
#admin-panel-pricing .section-heading { flex-wrap: wrap; gap: 12px; }
#model-form { max-width: 560px; min-width: 0; }
#model-form input { min-width: 0; }
#model-form .checkbox-label { display: flex; align-items: center; }
#model-form input[type="checkbox"] { width: 18px; height: 18px; }
#admin-panel-model .section-heading { flex-wrap: wrap; gap: 12px; }
@media (max-width: 580px) {
  .admin-tabs { flex-wrap: wrap; }
  .admin-tab { flex-basis: 40%; }
}
