:root {
  --ink: #16231d;
  --muted: #69766f;
  --paper: #f5f6f2;
  --panel: #ffffff;
  --line: #dde2dc;
  --line-strong: #c6cec7;
  --green: #176b4d;
  --green-dark: #0d4f38;
  --green-soft: #e7f3ed;
  --orange: #d8662e;
  --orange-soft: #fff0e7;
  --yellow-soft: #fff6d9;
  --red: #a43e36;
  --shadow: 0 18px 60px rgba(23, 43, 33, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 8%, rgba(216, 102, 46, 0.09), transparent 28rem),
    radial-gradient(circle at 90% 2%, rgba(23, 107, 77, 0.08), transparent 30rem),
    var(--paper);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 58px); line-height: 1.02; letter-spacing: -0.045em; }
h2 { margin: 0; font-size: 20px; letter-spacing: -0.025em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }

.app-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0 64px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #fff; background: var(--green); font-family: Georgia, serif; font-size: 17px; box-shadow: 0 8px 22px rgba(23, 107, 77, 0.2); }
.brand > span:last-child, .account-copy, .environment > span:last-child { display: grid; gap: 2px; min-width: 0; }
.brand strong { font-size: 16px; }
.brand small, .account-copy small, .environment small { color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.environment, .account-menu { display: flex; align-items: center; gap: 10px; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; background: rgba(255, 255, 255, 0.72); }
.environment strong { max-width: 230px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #2caf77; box-shadow: 0 0 0 5px rgba(44, 175, 119, 0.12); }
.avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: white; background: var(--green); font-family: Georgia, serif; }
.account-copy strong { max-width: 130px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.flow-nav { display: grid; grid-template-columns: 1fr 64px 1.25fr 64px 1fr; align-items: center; max-width: 820px; margin: 42px auto 54px; }
.flow-nav button { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; border: 0; padding: 0; color: #8b958f; background: transparent; text-align: left; }
.flow-nav button > span { display: grid; width: 34px; height: 34px; grid-row: 1 / 3; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; font-size: 12px; font-weight: 800; }
.flow-nav button strong { align-self: end; font-size: 13px; }
.flow-nav button small { align-self: start; font-size: 10px; }
.flow-nav button.active { color: var(--green-dark); }
.flow-nav button.active > span { border-color: var(--green); color: white; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.flow-nav button.done > span { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.flow-nav button.locked { cursor: not-allowed; }
.flow-nav i { height: 1px; margin: 0 10px; background: var(--line); }

.page { min-height: 560px; animation: page-in 220ms ease-out; }
@keyframes page-in { from { transform: translateY(7px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 10px; font-weight: 850; letter-spacing: 0.16em; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin-bottom: 8px; font-size: clamp(34px, 4vw, 48px); }
.page-heading p:last-child { margin: 0; color: var(--muted); font-size: 14px; }

.card { border: 1px solid rgba(214, 221, 215, 0.92); border-radius: 20px; background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.card-heading .eyebrow { margin-bottom: 5px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: 10px; font-weight: 780; white-space: nowrap; }
.badge.neutral { color: #687169; background: #ecefeb; }
.badge.accent { color: #93461f; background: var(--orange-soft); }
.badge.success { color: var(--green-dark); background: var(--green-soft); }
.badge.warning { color: #805714; background: var(--yellow-soft); }

.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 0.78fr); align-items: center; gap: clamp(36px, 8vw, 110px); max-width: 1080px; margin: 20px auto 0; }
.login-intro > p:not(.eyebrow) { max-width: 630px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.value-list { display: grid; gap: 0; padding: 0; margin: 38px 0 0; list-style: none; }
.value-list li { display: grid; grid-template-columns: 42px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.value-list li > span { color: var(--orange); font-family: Georgia, serif; font-size: 13px; }
.value-list li div { display: grid; gap: 4px; }
.value-list li strong { font-size: 14px; }
.value-list li small { color: var(--muted); font-size: 12px; }
.auth-card { padding: 28px; }
.login-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.login-method { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; min-height: 62px; border: 1px solid var(--line); border-radius: 13px; padding: 10px; color: var(--ink); background: #fff; text-align: left; }
.login-method.selected { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.login-method > span:nth-child(2) { display: grid; gap: 2px; }
.login-method strong { font-size: 12px; }
.login-method small { color: var(--muted); font-size: 9px; }
.login-method > i { color: var(--green); font-style: normal; font-weight: 800; }
.method-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: white; background: var(--green); font-size: 12px; font-weight: 850; }
.auth-panel { padding-top: 20px; border-top: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 18px; border-radius: 11px; padding: 4px; background: #eef1ed; }
.segmented button { min-height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 760; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(20, 42, 31, 0.08); }
label { display: grid; gap: 7px; margin-bottom: 14px; color: var(--muted); font-size: 11px; font-weight: 700; }
input { width: 100%; min-height: 44px; border: 1px solid #d4dbd5; border-radius: 11px; outline: none; padding: 10px 12px; color: var(--ink); background: #fff; transition: border-color 150ms ease, box-shadow 150ms ease; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.1); }
.form-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.channel-callout { display: flex; gap: 13px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fafbf9; }
.channel-callout div { display: grid; gap: 5px; }
.channel-callout strong { font-size: 13px; }
.channel-callout p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.button-row { display: flex; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: 9px 16px; font-weight: 760; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { color: white; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.ghost { border-color: var(--line-strong); color: var(--ink); background: rgba(255, 255, 255, 0.72); }
.button.ghost:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.button.danger { color: white; background: var(--red); }
.button.full { width: 100%; }
.button.compact { min-height: 32px; padding: 6px 10px; font-size: 10px; }

.commerce-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; gap: 22px; }
.catalog-grid { display: grid; gap: 12px; }
.product-card { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto 28px; align-items: center; gap: 16px; width: 100%; min-height: 112px; border: 1px solid var(--line); border-radius: 17px; padding: 18px; color: var(--ink); background: rgba(255, 255, 255, 0.83); text-align: left; transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.product-card:hover { transform: translateY(-1px); border-color: #b8c5bb; box-shadow: 0 10px 30px rgba(25, 48, 37, 0.07); }
.product-card.selected { border-color: var(--green); background: #fbfffc; box-shadow: inset 0 0 0 1px var(--green), 0 12px 34px rgba(23, 107, 77, 0.09); }
.product-icon { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 15px; color: var(--green); background: var(--green-soft); font-family: Georgia, serif; font-size: 24px; }
.product-copy { display: grid; gap: 5px; min-width: 0; }
.product-copy > small { color: var(--orange); font-size: 9px; font-weight: 800; letter-spacing: 0.09em; }
.product-copy > strong { font-size: 16px; }
.product-copy > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.price-copy { display: grid; gap: 4px; text-align: right; }
.price-copy strong { color: var(--green-dark); font-family: Georgia, serif; font-size: 21px; }
.price-copy small { color: var(--muted); font-size: 9px; }
.product-card > i { color: var(--green); font-style: normal; font-weight: 850; }
.checkout-card { position: sticky; top: 20px; padding: 24px; }
.checkout-product { display: grid; gap: 6px; margin-bottom: 18px; border-radius: 13px; padding: 15px; background: #f5f7f4; }
.checkout-product > span, .field-label, .checkout-total span { color: var(--muted); font-size: 10px; font-weight: 700; }
.checkout-product strong { font-size: 13px; }
.checkout-product small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.quantity-field { max-width: 120px; }
.payment-section { display: grid; gap: 8px; margin: 18px 0; }
.payment-methods { display: grid; gap: 8px; }
.payment-method { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; padding: 9px; color: var(--ink); background: white; text-align: left; }
.payment-method.selected { border-color: var(--green); background: var(--green-soft); }
.payment-method.channel-only { border-style: dashed; }
.payment-method > span:first-child { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: white; background: var(--green); font-size: 10px; font-weight: 850; }
.payment-method > span:nth-child(2) { display: grid; gap: 2px; }
.payment-method strong { font-size: 11px; }
.payment-method small { color: var(--muted); font-size: 9px; }
.payment-method i { color: var(--green); font-style: normal; }
.checkout-total { display: flex; align-items: flex-end; justify-content: space-between; margin: 20px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.checkout-total strong { color: var(--green-dark); font-family: Georgia, serif; font-size: 30px; }

.section-card { padding: 25px; }
.section-card + .section-card { margin-top: 18px; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.check-card { display: grid; grid-template-columns: 36px 1fr; gap: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: #fafbf9; }
.check-card > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: #7d8981; background: #ecefeb; font-family: Georgia, serif; font-size: 18px; }
.check-card.granted { border-color: #b8d8c7; background: var(--green-soft); }
.check-card.granted > span { color: white; background: var(--green); }
.check-card div { display: grid; gap: 2px; min-width: 0; }
.check-card small { color: var(--muted); font-size: 9px; }
.check-card strong { font-size: 13px; }
.check-card code { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.asset-list, .order-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.asset-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; min-height: 66px; padding: 11px 15px; background: #fff; }
.asset-row + .asset-row, .order-row + .order-row { border-top: 1px solid var(--line); }
.asset-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-soft); font-family: Georgia, serif; }
.asset-row > span:nth-child(2), .order-copy { display: grid; gap: 3px; min-width: 0; }
.asset-row strong, .order-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.asset-row small, .order-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.asset-value { font-family: Georgia, serif; font-size: 21px; }
.order-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 100px; align-items: center; gap: 12px; min-height: 66px; margin: 0; padding: 10px 15px; background: #fff; }
.order-row input { width: 16px; min-height: auto; accent-color: var(--green); }
.order-money { font-family: Georgia, serif; font-size: 16px; text-align: right; }
.refund-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 15px; border-radius: 13px; padding: 14px; background: #f5f7f4; }
.refund-bar div { display: grid; gap: 4px; }
.refund-bar span { color: var(--muted); font-size: 9px; }
.refund-bar strong { font-size: 11px; }

.developer-panel { margin-top: 42px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.68); }
.developer-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; cursor: pointer; list-style: none; }
.developer-panel > summary::-webkit-details-marker { display: none; }
.developer-panel > summary > span:first-child { display: grid; gap: 2px; }
.developer-panel summary strong { font-size: 12px; }
.developer-panel summary small { color: var(--muted); font-size: 9px; }
.trace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 12px 18px; }
.trace-toolbar p { margin: 0; color: var(--muted); font-size: 9px; }
.trace-list { display: grid; gap: 8px; padding: 0 18px 18px; }
.trace-item { overflow: hidden; border: 1px solid #34443b; border-radius: 10px; color: #dce8e1; background: #17231d; }
.trace-item summary { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 9px; min-height: 38px; padding: 8px 11px; cursor: pointer; list-style: none; }
.trace-method { color: #8ebda6; font-family: ui-monospace, monospace; font-size: 9px; font-weight: 800; }
.trace-path { overflow: hidden; font-family: ui-monospace, monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.trace-status { font-size: 9px; font-weight: 800; }
.trace-status.ok { color: #74d39f; }
.trace-status.error { color: #ff9d91; }
.trace-body { border-top: 1px solid #34443b; padding: 11px; }
.trace-meta { display: flex; flex-wrap: wrap; gap: 12px; color: #91a299; font-size: 8px; }
.trace-body h4 { margin: 10px 0 5px; color: #9aaca2; font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
pre { max-height: 260px; overflow: auto; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

.empty-state { display: grid; min-height: 120px; place-items: center; grid-column: 1 / -1; border: 1px dashed var(--line-strong); border-radius: 14px; padding: 18px; color: var(--muted); font-size: 11px; text-align: center; }
.empty-state.compact { min-height: 70px; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 390px; transform: translateY(18px); border-radius: 12px; padding: 12px 15px; color: white; background: #16231d; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: #8c362f; }

@media (max-width: 980px) {
  .app-header { align-items: flex-start; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .login-layout, .commerce-layout { grid-template-columns: 1fr; }
  .login-layout { max-width: 720px; }
  .checkout-card { position: static; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 28px, 1240px); padding-top: 18px; }
  .app-header { flex-direction: column; }
  .header-actions, .environment, .account-menu { width: 100%; }
  .account-copy { flex: 1; }
  .flow-nav { grid-template-columns: 1fr 24px 1fr 24px 1fr; margin: 30px auto 38px; }
  .flow-nav button { display: flex; align-items: center; flex-direction: column; gap: 6px; text-align: center; }
  .flow-nav button > span { grid-row: auto; }
  .flow-nav button small { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button-row, .page-heading > .button { width: 100%; }
  .page-heading .button { flex: 1; }
  .check-grid { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 44px 1fr 24px; }
  .product-icon { width: 44px; height: 44px; }
  .price-copy { grid-column: 2 / -1; text-align: left; }
  .product-card > i { grid-column: 3; grid-row: 1; }
  .order-row { grid-template-columns: 24px 1fr auto; }
  .order-money { grid-column: 2 / -1; text-align: left; }
}

@media (max-width: 480px) {
  .login-methods { grid-template-columns: 1fr; }
  .auth-card, .section-card, .checkout-card { padding: 18px; }
  .login-intro h1 { font-size: 38px; }
  .refund-bar { align-items: stretch; flex-direction: column; }
  .refund-bar .button { width: 100%; }
}
