:root {
  color-scheme: light;
  --ink: #18211d;
  --ink-soft: #34423b;
  --muted: #65736c;
  --subtle: #89958f;
  --line: #d9e0dc;
  --line-strong: #c4cec8;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --canvas: #f3f6f4;
  --green: #087a55;
  --green-dark: #056044;
  --green-soft: #e8f5ef;
  --blue: #2267a8;
  --blue-soft: #edf5fb;
  --amber: #8a5a08;
  --amber-soft: #fff5dd;
  --red: #b42318;
  --red-soft: #fff1ef;
  --shadow-sm: 0 5px 18px rgba(24, 33, 29, 0.06);
  --shadow-md: 0 18px 45px rgba(24, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
summary {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.52;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(217, 224, 220, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.brand .brand-wordmark { white-space: nowrap; font-weight: 750; }
.brand .brand-wordmark > span { font-weight: 600; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

.topbar-actions,
.button-row,
.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-badge::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.78;
}

.status-neutral {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.status-good {
  border-color: #b9dfce;
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-warning {
  border-color: #ead297;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-bad {
  border-color: #efc0b9;
  background: var(--red-soft);
  color: var(--red);
}

.app-layout {
  display: grid;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 112px);
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 24px;
  align-items: start;
  margin: 24px auto 44px;
}

.tool-panel,
.result-rail,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tool-panel {
  min-width: 0;
  padding: 24px 28px;
}

.section-heading,
.result-heading,
.admin-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.page-heading {
  align-items: center;
  padding-bottom: 20px;
}

.page-heading h1 {
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

.step-count,
.result-index {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.step-count {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
}

.guide-button {
  min-height: 36px;
  padding-inline: 10px;
}

.usage-dialog {
  flex-direction: column;
  width: min(760px, calc(100% - 32px));
  height: fit-content;
  max-height: min(820px, calc(100vh - 32px));
  max-height: min(820px, calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 80px rgba(24, 33, 29, 0.24);
  padding: 0;
  color: var(--ink);
}

.usage-dialog[open] {
  display: flex;
}

.usage-dialog::backdrop {
  background: rgba(17, 24, 21, 0.48);
  backdrop-filter: blur(3px);
}

.dialog-heading,
.dialog-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
}

.dialog-heading {
  border-bottom: 1px solid var(--line);
}

.dialog-heading .eyebrow {
  margin-bottom: 4px;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
}

.dialog-close:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.dialog-content {
  flex: 0 1 auto;
  min-height: 0;
  min-width: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 22px 24px;
}

.guide-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.guide-comparison article {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 16px;
}

.guide-comparison article:first-child {
  border-color: #b9dfce;
  background: var(--green-soft);
}

.guide-label {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
}

.guide-comparison h3,
.guide-section h3 {
  margin: 5px 0 7px;
  font-size: 15px;
}

.guide-comparison p,
.guide-section p,
.guide-section ol {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.guide-section {
  margin-top: 22px;
}

.guide-section ol {
  padding-left: 20px;
}

.guide-section li + li {
  margin-top: 6px;
}

.guide-section a {
  color: var(--blue);
  font-weight: 750;
}

.format-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}

.format-list code {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f5f7f6;
  padding: 8px 9px;
  color: var(--ink-soft);
  font-size: 12px;
}

.guide-warning {
  margin: 22px 0 0;
  border-left: 3px solid #d2a24a;
  background: var(--amber-soft);
  padding: 11px 12px;
  color: #71500f;
  font-size: 13px;
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.dialog-actions .primary-button {
  min-width: 116px;
}

.history-dialog {
  width: min(720px, calc(100% - 32px));
}

.price-reference-dialog {
  width: min(900px, calc(100% - 32px));
}

.price-reference-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.price-reference-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.price-reference-table th,
.price-reference-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.price-reference-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

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

.price-reference-table tbody tr.selected {
  background: var(--green-soft);
}

.price-country-button {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-weight: 750;
  padding: 0;
}

.price-country-button:hover {
  text-decoration: underline;
}

.price-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

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

.price-reference-empty {
  padding: 24px !important;
  color: var(--muted);
  text-align: center !important;
}

.history-summary {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.history-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-item-heading,
.history-actions,
.entitlement-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-item-heading {
  justify-content: space-between;
}

.history-item-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-item-heading time,
.history-meta {
  color: var(--muted);
  font-size: 12px;
}

.history-meta {
  margin: 6px 0 10px;
}

.history-url {
  display: block;
  overflow: hidden;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.history-actions .secondary-button,
.history-actions .compact-button {
  min-height: 36px;
  padding: 8px 12px;
}

.history-empty {
  margin: 0;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

.history-error {
  color: var(--red);
}

.history-load-more {
  display: block;
  margin: 14px auto 0;
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.form-section.compact-section {
  padding: 18px 0;
}

.form-section legend {
  margin-bottom: 14px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.field-block {
  min-width: 0;
  margin-top: 15px;
}

.field-block:first-child {
  margin-top: 0;
}

.field-block > label,
.field-label-row label,
.platform-access > div > label {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-block > label,
.platform-access > div > label,
.field-label-row {
  margin-bottom: 7px;
}

.field-label-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-block label span {
  color: var(--subtle);
  font-weight: 500;
}

.session-link {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.session-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  padding: 10px 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #a9b6af;
}

textarea {
  min-height: 136px;
  resize: vertical;
  background: #fbfcfb;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 122, 85, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: #9aa49f;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.42fr);
  gap: 15px;
}

.two-column > .field-block {
  margin-top: 0;
}

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

#linkForm .form-section:not(.compact-section) {
  padding: 18px 0;
}

#sessionJson {
  height: 116px;
  min-height: 100px;
}

#linkForm .team-grid {
  margin-top: 16px;
}

#linkForm > .primary-button {
  margin-top: 18px;
  background: var(--green-dark);
}

#linkForm > .primary-button:hover:not(:disabled) {
  background: var(--green);
}

.segmented-control {
  display: grid;
  width: 100%;
  min-height: 46px;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #eef2f0;
  padding: 3px;
}

.segmented-control label {
  position: relative;
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.segmented-control label:hover span {
  color: var(--ink-soft);
}

.segmented-control input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(24, 33, 29, 0.14);
}

.segmented-control input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(8, 122, 85, 0.16);
}

.platform-access {
  margin-top: 15px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  padding: 13px 14px;
}

.inline-form input {
  min-width: 0;
  background: #fff;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.inline-form .secondary-button {
  min-width: 82px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.entitlement-line {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.entitlement-line strong,
.entitlement-line small {
  display: block;
}

.entitlement-line strong {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.entitlement-line small {
  margin-top: 3px;
  color: var(--muted);
}

.entitlement-actions {
  flex: 0 0 auto;
}

.field-message {
  margin: 10px 0 0;
  color: var(--amber);
  font-size: 13px;
}

.error-text {
  color: var(--red);
}

.primary-button,
.secondary-button,
.text-button,
.tab-button {
  min-height: 44px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  padding: 9px 16px;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

#linkForm > .primary-button,
#batchForm > .primary-button,
#loginForm > .primary-button {
  width: 100%;
  margin-top: 22px;
}

#linkForm > .primary-button {
  min-height: 50px;
  font-size: 14px;
}

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

.primary-button:hover:not(:disabled) {
  background: #29352f;
  transform: translateY(-1px);
}

.secondary-button {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: #93a199;
  background: var(--surface-soft);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  padding: 7px 5px;
}

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

.compact-button {
  min-width: 88px;
}

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

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

.country-field {
  position: relative;
}

.country-dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(24, 33, 29, 0.16);
  padding: 5px;
}

.country-dropdown.country-dropdown-side {
  position: fixed;
  z-index: 80;
  width: 380px;
  max-height: min(520px, calc(100vh - 32px));
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.country-option {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 7px 10px;
  text-align: left;
}

.country-option:hover,
.country-option.active {
  background: var(--green-soft);
}

.country-option strong,
.country-option small {
  display: block;
}

.country-option small {
  color: var(--muted);
}

.country-empty {
  margin: 0;
  padding: 13px;
  color: var(--muted);
}

.result-rail {
  position: sticky;
  top: 96px;
  display: grid;
  min-width: 0;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.result-rail .rail-section {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 22px;
}

.summary-panel {
  border-bottom: 1px solid var(--line);
}

.summary-list {
  display: grid;
  grid-template-columns: 1fr 1.35fr 0.45fr;
  column-gap: 16px;
}

.summary-list > div:not(.summary-fact) {
  grid-column: 1 / -1;
}

.summary-list > .summary-fact {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 4px 0 14px;
  border-bottom: 0;
}

.summary-list > .summary-fact + div:not(.summary-fact) {
  border-top: 1px solid var(--line);
}

.summary-fact dd {
  text-align: left;
  font-size: 14px;
}

.summary-list,
.price-list {
  margin: 9px 0 0;
}

.result-price-hint {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.summary-list > div,
.price-list > div {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.summary-list > div:last-child,
.price-list > div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 750;
}

.summary-price {
  display: flex;
  max-width: 72%;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
}

#priceReferenceSummary,
.charge-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.charge-summary {
  max-width: 68%;
}

.summary-action {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 750;
  padding: 0;
}

.summary-action:hover {
  color: var(--green);
  text-decoration: underline;
}

.checkout-result {
  margin-top: 20px;
  scroll-margin-block: 88px 20px;
  outline: none;
}

.checkout-result .result-placeholder {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.result-placeholder::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--subtle);
  content: "";
}

.result-placeholder h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.result-index {
  color: var(--green);
}

.usage-link-detail textarea[data-access-token-value] {
  width: 100%;
  margin: 10px 0;
  min-height: 88px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.usage-link-detail small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}

.regional-price-panel {
  border-top: 1px solid var(--line);
}

.result-rail .regional-price-panel {
  border-top: 1px solid var(--line);
}

.regional-price-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.regional-price-heading .eyebrow {
  margin-bottom: 3px;
}

.regional-price-heading h2 {
  font-size: 15px;
  line-height: 1.3;
}

.discount-badge {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
}

.regional-price-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.regional-price-columns,
.regional-price-item {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.17fr) minmax(0, 0.87fr) minmax(0, 0.82fr);
  column-gap: 5px;
}

.regional-price-columns {
  display: grid;
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.regional-price-columns span:not(:first-child) {
  text-align: right;
}

.regional-price-item {
  display: grid;
  min-width: 0;
  min-height: 44px;
  align-content: center;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
}

.regional-price-item:hover,
.regional-price-item.selected {
  background: var(--green-soft);
}

.regional-price-item.selected {
  box-shadow: inset 3px 0 0 var(--green);
}

.regional-price-item strong,
.regional-price-item span,
.regional-price-item small {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.regional-price-item strong {
  font-size: 12px;
}

.regional-price-amount {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.regional-price-item span,
.regional-price-item small {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.regional-price-item small,
.regional-price-hint,
.regional-price-empty {
  color: var(--muted);
  font-size: 11px;
}

.regional-price-usd,
.regional-price-cny {
  white-space: nowrap;
  font-size: 10px;
}

.regional-price-hint {
  margin: 11px 0 0;
  line-height: 1.5;
}

.regional-price-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 4px;
  text-align: center;
}

@media (max-width: 1100px) {
  .regional-price-columns {
    display: none;
  }

  .regional-price-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 5px;
  }

  .regional-price-item .regional-price-usd {
    text-align: left;
  }

  .regional-price-usd::before {
    content: '约美元 ';
    color: var(--muted);
  }

  .regional-price-cny::before {
    content: '约人民币 ';
    color: var(--muted);
  }
}

.success-panel {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.success-panel .result-heading {
  align-items: center;
  gap: 12px;
}

.success-panel h2 {
  font-size: 17px;
}

.result-status {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}

.success-panel .price-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.success-panel .price-list > div {
  display: block;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0;
}

.success-panel .price-list dd {
  margin-top: 4px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.error-panel {
  padding: 16px 18px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
}

.error-panel h2 {
  font-size: 17px;
}

.error-suggestion {
  margin: 12px 0 0;
  border-left: 3px solid #d7998f;
  background: rgba(255, 255, 255, 0.58);
  padding: 9px 11px;
  color: #7f2a22;
  font-size: 13px;
}

.price-list dd {
  font-size: 16px;
}

.result-link {
  display: block;
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid #c9d9e6;
  border-radius: 6px;
  background: var(--blue-soft);
  padding: 11px 12px;
  color: var(--blue);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.success-panel .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recent-history-button {
  margin-left: auto;
}

.request-id {
  margin: 14px 0 0;
  color: #7f3028;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.login-layout {
  display: grid;
  min-height: calc(100vh - 72px);
  place-items: center;
  padding: 32px 20px;
}

.login-panel {
  width: min(430px, 100%);
  padding: 30px;
}

.login-panel form {
  margin-top: 24px;
}

.admin-layout {
  width: min(1240px, calc(100% - 40px));
  margin: 28px auto 50px;
}

.admin-heading {
  align-items: center;
  margin-bottom: 22px;
}

.admin-page-heading {
  padding: 4px 0;
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.stats-band > div {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.stats-band > div:last-child {
  border-right: 0;
}

.stats-band span,
.stats-band strong {
  display: block;
}

.stats-band span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stats-band strong {
  margin-top: 6px;
  font-size: 24px;
}

.admin-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(360px, 1.25fr);
  gap: 20px;
  margin-top: 22px;
}

.admin-panel {
  box-shadow: var(--shadow-sm);
}

.compact-panel {
  padding: 22px;
}

.compact-heading {
  padding-bottom: 16px;
}

.generated-panel textarea {
  margin-top: 16px;
  background: var(--surface-soft);
}

.generated-panel .button-row {
  margin-top: 12px;
}

.view-tabs {
  position: sticky;
  z-index: 20;
  top: 71px;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  margin-top: 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 244, 0.96);
  scrollbar-width: thin;
}

.tab-button {
  min-width: 110px;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
}

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

.tab-button.active {
  border-bottom-color: var(--green);
  color: var(--ink);
}

.data-view {
  min-width: 0;
  padding-top: 18px;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px auto;
  gap: 10px;
  margin-bottom: 12px;
}

.inventory-filters {
  grid-template-columns: minmax(190px, 1fr) minmax(150px, 0.65fr) 120px 130px auto auto;
}

.bulk-toolbar,
.pagination-bar,
.view-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.bulk-toolbar {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.bulk-toolbar strong {
  color: var(--ink);
}

.danger-button {
  border-color: #e6b4ae;
  color: var(--red);
}

.check-column {
  width: 48px;
  padding-right: 8px;
  padding-left: 14px;
}

.check-column input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.pagination-bar {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar .secondary-button {
  min-height: 38px;
}

.view-heading {
  margin-bottom: 12px;
}

.view-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.batch-table {
  min-width: 980px;
}

.batch-actions {
  min-width: 300px;
  flex-wrap: wrap;
}

.failure-detail {
  min-width: 260px;
  max-width: 420px;
  white-space: pre-line;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  scrollbar-color: #b6c1bb transparent;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

td {
  font-size: 13px;
}

tbody tr:hover td {
  background: #fbfcfb;
}

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

.table-code,
.table-request {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.table-request {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  min-width: 190px;
  gap: 6px;
}

.table-action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.table-action:hover {
  border-color: #9eaba4;
  background: var(--surface-soft);
}

.table-action.danger {
  border-color: #e6b4ae;
  color: var(--red);
}

.empty-row {
  height: 96px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr) 390px;
  }

  .tool-panel {
    padding-right: 26px;
    padding-left: 26px;
  }

}

@media (max-width: 960px) {
  .app-layout,
  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .result-rail {
    position: static;
    grid-template-columns: minmax(0, 1fr);
  }

  .result-rail .summary-panel {
    border-right: 0;
    border-bottom: 0;
  }

  .regional-price-panel {
    grid-column: 1 / -1;
  }

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

  .stats-band > div:nth-child(2) {
    border-right: 0;
  }

  .stats-band > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .admin-workspace {
    gap: 16px;
  }

  .inventory-filters {
    grid-template-columns: minmax(220px, 1fr) 1fr 120px 130px;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand strong {
    font-size: 17px;
  }

  .app-layout,
  .admin-layout {
    width: calc(100% - 24px);
    margin-top: 14px;
    margin-bottom: 28px;
  }

  .app-layout {
    gap: 14px;
  }

  .tool-panel,
  .login-panel {
    padding: 20px;
  }

  .result-rail .rail-section {
    padding: 20px;
  }

  .usage-dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .dialog-heading,
  .dialog-actions {
    padding: 16px 18px;
  }

  .dialog-content { padding: 18px; }

  .price-reference-table {
    min-width: 0;
  }

  .price-reference-table thead {
    display: none;
  }

  .price-reference-table tbody,
  .price-reference-table tr {
    display: block;
  }

  .price-reference-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
  }

  .price-reference-table tr:last-child {
    border-bottom: 0;
  }

  .price-reference-table td {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    border: 0;
    padding: 6px 4px;
    text-align: left !important;
    white-space: normal;
  }

  .price-reference-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 650;
  }

  .price-reference-table td:first-child {
    grid-column: 1 / -1;
    margin-bottom: 3px;
    border-bottom: 1px solid var(--line);
  }

  .price-reference-table td:first-child::before,
  .price-reference-table .price-reference-empty::before {
    display: none;
  }

  .price-reference-table .price-reference-empty {
    grid-column: 1 / -1;
    align-items: center;
  }

  .guide-comparison,
  .format-list {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 22px;
  }

  .step-count {
    display: none;
  }

  .form-section {
    padding: 21px 0;
  }

  .form-section.compact-section {
    padding: 16px 0;
  }

  .billing-grid,
  .table-toolbar,
  .inventory-filters {
    grid-template-columns: 1fr;
  }

  .bulk-toolbar,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-toolbar .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .result-rail .summary-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-heading h1 {
    font-size: 21px;
  }

  #linkForm .team-grid {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .regional-price-columns,
  .regional-price-item {
    padding-inline: 6px;
    column-gap: 6px;
  }

  .summary-list {
    column-gap: 10px;
  }

  .success-panel .price-list {
    gap: 8px;
  }

  .success-panel .price-list dd {
    font-size: 14px;
  }

  .success-panel .result-actions > a,
  .success-panel .result-actions > button:not(.recent-history-button) {
    flex: 1 1 0;
  }

  .recent-history-button {
    flex-basis: 100%;
    min-height: 36px;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    margin-left: 0;
  }

  .inline-form {
    align-items: stretch;
  }

  .inline-form .secondary-button {
    flex: 0 0 auto;
  }

  .history-item-heading {
    align-items: flex-start;
  }

  .history-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .summary-price,
  .charge-summary {
    max-width: 72%;
  }

  .success-panel .button-row {
    grid-template-columns: 1fr 1fr;
  }

  .compact-button {
    min-width: 0;
  }

  .admin-page-heading {
    align-items: flex-end;
  }

  .compact-panel {
    padding: 20px;
  }

  .view-tabs {
    top: 63px;
    margin-top: 22px;
  }

  .table-wrap {
    margin-right: -2px;
  }
}

@media (max-width: 460px) {
  .brand small {
    display: none;
  }

  .status-badge {
    min-height: 28px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .tool-panel,
  .rail-section,
  .login-panel,
  .compact-panel {
    padding: 18px;
  }

  .guide-button {
    padding-inline: 6px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .dialog-actions .primary-button {
    width: 100%;
  }

  .field-label-row {
    align-items: flex-start;
  }

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

  .inline-form {
    flex-direction: column;
  }

  .inline-form > * {
    width: 100%;
  }

  .entitlement-line {
    align-items: stretch;
    flex-direction: column;
  }

  .entitlement-actions {
    justify-content: space-between;
  }

  .history-item-heading {
    flex-direction: column;
    gap: 4px;
  }

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

  .history-actions > * {
    width: 100%;
  }

  .stats-band > div {
    padding: 15px;
  }

  .stats-band strong {
    font-size: 20px;
  }

  .admin-heading {
    gap: 12px;
  }

  .admin-heading .secondary-button {
    padding-right: 12px;
    padding-left: 12px;
  }

  .bulk-toolbar .button-row,
  .pagination-bar .button-row,
  .generated-actions {
    grid-template-columns: 1fr;
  }

  .bulk-toolbar .button-row > *,
  .generated-actions > * {
    width: 100%;
  }
}

@media (pointer: coarse) {
  button,
  input,
  textarea,
  select,
  .primary-button,
  .secondary-button,
  .tab-button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
