:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b2028;
  --muted: #687180;
  --line: #e5e7eb;
  --line-strong: #d4d8de;
  --primary: #315efb;
  --primary-dark: #2449ce;
  --soft: #f1f3f6;
  --ok: #247451;
  --warn: #976315;
  --danger: #b34444;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: 28px; line-height: 1.25; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 18px; }
h3 { margin-bottom: 0; font-size: 18px; }

.topbar { min-height: 66px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:focus-visible { outline: 3px solid #dfe5ff; outline-offset: 4px; border-radius: 7px; }
.brand-mark { position: relative; display: grid; place-items: center; width: 35px; height: 35px; overflow: hidden; border-radius: 10px; background: #171c24; color: #fff; font-size: 16px; font-weight: 900; transform: skew(-4deg); }
.brand-mark::before { content: ""; position: absolute; width: 26px; height: 7px; right: -7px; top: 4px; background: var(--primary); transform: rotate(-35deg); }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 6px; right: 5px; bottom: 5px; border-radius: 2px; background: var(--primary); }
.brand-mark span { position: relative; z-index: 1; transform: skew(4deg); }
.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { font-size: 17px; font-weight: 850; letter-spacing: -.045em; }
.brand-copy strong span { color: var(--primary); }
.brand-copy small { margin-top: 4px; color: #7b8491; font-size: 10px; font-weight: 650; letter-spacing: .16em; }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.topbar nav > a, .link-button { padding: 8px 10px; border-radius: 7px; color: #515a68; text-decoration: none; white-space: nowrap; }
.topbar nav > a:hover, .topbar nav > a.active, .link-button:hover { background: var(--soft); color: var(--text); }
.nav-count { display: inline-grid; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; place-items: center; border-radius: 20px; background: var(--primary); color: #fff; font-size: 11px; }
.link-button { border: 0; background: transparent; cursor: pointer; font: inherit; }
.inline-form { display: inline; }

.container { max-width: 1180px; margin: 0 auto; padding: 36px 24px 56px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.compact-heading { margin-bottom: 18px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--primary); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.muted { margin-bottom: 0; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.panel, .auth-card, .stat, .catalog-panel, .account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.panel { margin-top: 18px; padding: 20px; }
.panel-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-link { color: var(--primary); font-weight: 650; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }

.button, button { border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: var(--soft); color: #343c48; border: 1px solid var(--line-strong); }
.secondary:hover { background: #e8ebef; }
.small { padding: 7px 11px; }
.full { width: 100%; margin-top: 12px; }
.actions { display: flex; align-items: center; gap: 10px; }
.button-link { padding: 6px 4px; background: transparent; }
.button-link:hover { text-decoration: underline; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.catalog-panel, .account-card { padding: 22px; }
.product-grid { display: grid; gap: 14px; }
.product-card { display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; }
.product-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px; background: #eef1ff; color: var(--primary); font-size: 20px; font-weight: 800; }
.small-mark { width: 38px; height: 38px; border-radius: 8px; font-size: 15px; }
.qa-mark { background: #e9f4f1; color: #19705a; font-size: 13px; letter-spacing: -.04em; }
.product-title { display: flex; align-items: center; gap: 10px; }
.product-content > p { margin: 7px 0 12px; color: var(--muted); }
.product-points { display: flex; flex-wrap: wrap; gap: 7px 20px; margin: 0; padding: 0; color: #4c5563; list-style: none; font-size: 13px; }
.product-points li::before { content: "✓"; margin-right: 6px; color: var(--ok); font-weight: 800; }
.product-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.price strong { display: inline-block; margin-right: 5px; font-size: 25px; }
.price span { color: var(--muted); font-size: 12px; }
.badge, .status { display: inline-block; border-radius: 99px; padding: 3px 9px; background: #edf0f4; color: #535d6c; font-size: 12px; font-weight: 650; white-space: nowrap; }

.account-card { align-self: start; }
.card-label { display: block; color: var(--muted); }
.balance { display: inline-block; margin-top: 8px; font-size: 32px; line-height: 1; }
.balance-unit { margin-left: 4px; color: var(--muted); }
.account-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0 10px; }
.account-lines span { padding: 10px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 12px; }
.account-lines b { display: block; margin-top: 3px; color: var(--text); font-size: 14px; }
.account-card > p { color: var(--muted); }
.account-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.account-shortcuts a { padding: 11px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.account-shortcuts span, .account-shortcuts b { display: block; }
.account-shortcuts span { color: var(--muted); font-size: 12px; }
.account-shortcuts b { margin-top: 2px; }

.recent-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
.task-table { min-width: 860px; }
.task-table td > strong, .task-table td > small { display: block; }
.task-table td > small { margin-top: 3px; color: var(--muted); }
.task-progress { min-width: 125px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e7e9ed; }
.progress-track-large { height: 10px; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .2s ease; }
.row-actions { min-width: 95px; }
.row-actions .text-link { display: block; margin: 3px 0; }

.status-succeeded, .badge.ok { background: #e5f3ec; color: var(--ok); }
.status-failed { background: #f8e7e7; color: var(--danger); }
.status-running, .status-retry_wait { background: #f8efdd; color: var(--warn); }
.status-q_running, .status-lookup_running, .status-a_running { background: #f8efdd; color: var(--warn); }
.status-q_queued, .status-a_queued, .status-waiting_link, .status-waiting_mail, .status-waiting_mailbox, .status-waiting_reader, .status-waiting_resource { background: #edf0f4; color: #535d6c; }
.status-cancelled { background: #edf0f4; color: #687180; }
.status-partial { background: #f8efdd; color: var(--warn); }
.ok-text { color: var(--ok) !important; }
.danger-text { color: var(--danger) !important; }

.checkout-layout { display: grid; grid-template-columns: minmax(0, 700px) 320px; gap: 18px; align-items: start; }
.order-form-panel { margin-top: 0; }
.order-form-panel label, .form-panel label, .auth-card label { display: block; margin-bottom: 19px; font-weight: 700; }
.field-hint { float: right; color: var(--muted); font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: 7px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 11px 12px; background: #fff; color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid #dfe5ff; border-color: var(--primary); }
.order-summary { position: sticky; top: 84px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); }
.order-summary h2 { margin-bottom: 15px; }
.summary-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-row span { color: var(--muted); }
.order-summary > p, .cart-summary > p, .cart-summary > small { display: block; margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.error, .errorlist { display: block; margin-top: 5px; color: var(--danger); }

.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.cart-items { margin-top: 0; padding: 0 20px; }
.cart-item { display: grid; grid-template-columns: 180px minmax(0, 1fr) 180px; gap: 20px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-service { display: flex; align-items: center; gap: 10px; }
.cart-service strong, .cart-service small { display: block; }
.cart-service small { margin-top: 3px; color: var(--muted); }
.cart-data { display: grid; grid-template-columns: 70px minmax(140px, 1.4fr) minmax(110px, 1fr) 60px; gap: 12px; margin: 0; }
.cart-data dt { color: var(--muted); font-size: 12px; }
.cart-data dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.qa-cart-data { grid-template-columns: 55px 115px minmax(150px, 1fr) minmax(150px, 1fr); }
.cart-price { text-align: right; }
.cart-price > span { display: block; margin-bottom: 8px; font-weight: 700; }
.cart-price .actions { justify-content: flex-end; }
.cart-summary { position: sticky; top: 84px; margin-top: 0; }
.cart-summary h2 { margin-bottom: 12px; }
.summary-total { display: flex; justify-content: space-between; gap: 15px; padding-top: 16px; font-size: 15px; }
.summary-total strong { font-size: 19px; }

.filter-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 0; padding: 12px; }
.filter-tabs { display: flex; gap: 4px; }
.filter-tabs a { padding: 8px 13px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.filter-tabs a:hover, .filter-tabs a.active { background: var(--soft); color: var(--text); font-weight: 700; }
.search-form { display: flex; gap: 8px; width: min(390px, 100%); }
.search-form input { margin: 0; }
.search-form select { width: 130px; margin: 0; }
.task-search-form { width: min(570px, 100%); }
.task-list-panel { padding-top: 8px; }
.batch-download-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 2px 12px; }
.batch-download-bar strong, .batch-download-bar span { display: block; }
.batch-download-bar span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.task-select { width: 38px; text-align: center; }
.task-select input { display: inline-block; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--primary); }
button:disabled { cursor: not-allowed; opacity: .5; }

.batch-panel { margin-top: 0; }
.batch-heading { align-items: flex-start; }
.form-alert { margin-bottom: 14px; padding: 11px 13px; border: 1px solid #edcccc; border-radius: 8px; background: #fbefef; color: #963a3a; }
.form-alert .errorlist { margin: 0; padding-left: 18px; }
.batch-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.batch-table { min-width: 850px; }
.batch-table th { background: #fafafa; }
.batch-table th, .batch-table td { padding: 9px 8px; }
.batch-table th:nth-child(2) { width: 105px; }
.batch-table th:nth-child(3) { width: 42%; }
.batch-table th:nth-child(4) { width: 190px; }
.batch-table th:nth-child(5) { width: 100px; }
.batch-table th:last-child { width: 48px; }
.batch-table input, .batch-table select { min-width: 0; margin: 0; padding: 9px 10px; }
.qa-batch-table { min-width: 980px; }
.qa-batch-table th:nth-child(2) { width: 92px; }
.qa-batch-table th:nth-child(3) { width: 155px; }
.qa-batch-table th:nth-child(4), .qa-batch-table th:nth-child(5) { width: 34%; }
.qa-batch-table textarea { min-width: 250px; min-height: 66px; margin: 0; padding: 9px 10px; resize: vertical; }
.batch-table .site-code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.batch-table .error { max-width: 250px; font-size: 11px; }
.row-number { width: 42px; color: var(--muted); text-align: center; }
.row-remove { text-align: center; }
.icon-button { display: inline-grid; width: 30px; height: 30px; padding: 0; place-items: center; border-radius: 7px; background: transparent; color: #8a929e; font-size: 20px; font-weight: 400; }
.icon-button:hover { background: #f8e7e7; color: var(--danger); }
.table-tip { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.paste-tip { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.paste-tip kbd { min-width: 28px; padding: 3px 6px; border: 1px solid #cfd5dd; border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--text); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.paste-tip #paste-status { margin-left: auto; }
.paste-tip #paste-status.error { margin-top: 0; }
.batch-checkout { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.batch-total { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.batch-total > span { color: var(--muted); }
.batch-total strong { color: var(--text); }
.batch-submit { text-align: right; }
.batch-submit > p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.batch-submit .actions { justify-content: flex-end; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 18px; }
.detail-layout > .panel { margin-top: 0; }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 0; }
.info-list div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.info-list dt { color: var(--muted); font-size: 12px; }
.info-list dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.info-list .wide-info { grid-column: 1 / -1; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.metrics div { padding: 11px; border-radius: 8px; background: var(--soft); }
.metrics span, .metrics strong { display: block; }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { margin-top: 3px; font-size: 18px; }
.progress-card > p { margin: 18px 0 0; }
.detail-note { padding: 11px; border-radius: 8px; background: #fbefef; }
.execution-table { min-width: 900px; }
.qa-timeline { display: grid; gap: 0; margin: 3px 0 4px; }
.timeline-step { position: relative; display: grid; grid-template-columns: 20px 1fr; gap: 10px; min-height: 58px; color: var(--muted); }
.timeline-step::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: -4px; width: 2px; background: var(--line); }
.timeline-step:last-child::before { display: none; }
.timeline-step > span { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 2px; border: 3px solid #d5dae1; border-radius: 50%; background: #fff; }
.timeline-step strong, .timeline-step small { display: block; }
.timeline-step small { margin-top: 2px; color: var(--muted); }
.timeline-step.done > span { border-color: var(--ok); background: var(--ok); }
.timeline-step.done { color: var(--text); }
.timeline-step.active > span { border-color: var(--primary); box-shadow: 0 0 0 4px #e7ecff; }
.timeline-step.active { color: var(--text); }
.result-links { display: grid; gap: 12px; margin: 0; }
.result-links div { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.result-links div:last-child { border-bottom: 0; }
.result-links dt { color: var(--muted); }
.result-links dd { margin: 0; }
.break-link { white-space: normal; overflow-wrap: anywhere; }

.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 4px; color: var(--text); font-size: 16px; }
.empty-card { padding: 60px 20px; text-align: center; }
.empty-card p { color: var(--muted); }
.empty-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 15px; place-items: center; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 20px; font-weight: 800; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 17px; }
.stat span { display: block; color: var(--muted); }
.stat strong { display: block; margin-top: 4px; font-size: 24px; }
.form-panel { max-width: 680px; }
.detail { max-width: 340px; word-break: break-word; }
.auth-card { width: min(420px, 100%); margin: 70px auto; padding: 28px; }
.message { margin-bottom: 15px; padding: 12px 15px; border: 1px solid #cdd8ff; border-radius: 8px; background: #f0f3ff; color: #2949b3; }
.message.success { border-color: #cae6d8; background: #edf8f2; color: #236243; }
.message.error { border-color: #edcccc; background: #fbefef; color: #963a3a; }

@media (max-width: 960px) {
  .home-layout, .checkout-layout, .cart-layout, .detail-layout { grid-template-columns: 1fr; }
  .account-card, .order-summary, .cart-summary { position: static; }
  .cart-item { grid-template-columns: 160px minmax(0, 1fr); }
  .cart-price { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .cart-price > span { margin: 0; }
}

@media (max-width: 760px) {
  .topbar { position: static; flex-direction: column; align-items: stretch; gap: 10px; padding: 13px 16px; }
  .brand { align-self: flex-start; }
  .topbar nav { margin: 0 -4px; overflow-x: auto; }
  .topbar nav > a, .link-button { padding: 7px 8px; }
  .container { padding: 25px 14px 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .product-card { grid-template-columns: 1fr; }
  .product-footer { align-items: flex-start; flex-direction: column; }
  .product-footer .button { width: 100%; text-align: center; }
  .filter-panel { align-items: stretch; flex-direction: column; }
  .filter-tabs { overflow-x: auto; }
  .search-form { width: 100%; }
  .task-search-form { flex-wrap: wrap; }
  .task-search-form select { width: 125px; }
  .task-search-form input { min-width: 180px; flex: 1; }
  .batch-download-bar { align-items: stretch; flex-direction: column; }
  .cart-item { grid-template-columns: 1fr; }
  .cart-data { grid-template-columns: 1fr 1fr; }
  .cart-price { grid-column: auto; align-items: flex-start; flex-direction: column; gap: 8px; }
  .actions { flex-wrap: wrap; }
  .order-form-panel .actions button { flex: 1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .paste-tip #paste-status { width: 100%; margin-left: 0; }
  .batch-heading, .batch-checkout { align-items: stretch; flex-direction: column; }
  .batch-submit { width: 100%; text-align: left; }
  .batch-submit .actions { justify-content: stretch; }
  .batch-submit .actions button { flex: 1; }
}
