:root {
  color-scheme: light;
  --bg: #eef3ff;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #172033;
  --muted: #64748b;
  --line: #dfe6f2;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --violet: #8b5cf6;
  --success: #0f9f6e;
  --warning: #b45309;
  --danger: #c2413b;
  --shadow: 0 18px 48px rgba(63, 82, 132, 0.12);
  --shadow-soft: 0 8px 24px rgba(63, 82, 132, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(59, 130, 246, 0.14), transparent 30rem),
    radial-gradient(circle at 90% 10%, rgba(139, 92, 246, 0.12), transparent 28rem),
    var(--bg);
  font: 15px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.56; }
input, textarea {
  width: 100%;
  border: 1px solid #cfd8e8;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input { min-height: 50px; padding: 0 14px; }
textarea { resize: vertical; padding: 13px 14px; }
input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.13);
}
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.42);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.page-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.main { width: min(940px, calc(100% - 36px)); margin: 0 auto; padding: 32px 0 64px; flex: 1; }
.view { display: none; animation: view-in 220ms ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

.hero-card {
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "eyebrow aside"
    "title aside";
  align-items: center;
  column-gap: 30px;
  padding: 24px 30px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  text-align: left;
}
.hero-card::after {
  position: absolute;
  width: 150px;
  height: 150px;
  right: -86px;
  bottom: -105px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(139, 92, 246, 0.16));
  content: "";
}
.eyebrow { margin: 0 0 5px; color: var(--primary-dark); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 5vw, 44px); line-height: 1.16; letter-spacing: -0.025em; }
h2 { margin-bottom: 6px; font-size: 22px; line-height: 1.3; }
.hero-card .eyebrow { grid-area: eyebrow; }
.hero-card h1 {
  grid-area: title;
  margin-bottom: 0;
  background: linear-gradient(100deg, #2563eb, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(26px, 3.4vw, 34px);
}
.language-control { position: relative; z-index: 1; grid-area: aside; display: flex; min-height: 34px; align-items: center; justify-self: end; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.language-control select {
  min-width: 132px;
  height: 34px;
  border: 1px solid #d4ddeb;
  border-radius: 9px;
  padding: 0 30px 0 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  outline: none;
  cursor: pointer;
}
html[lang="en"] .hero-card, html[lang="ru"] .hero-card { padding-top: 20px; padding-bottom: 20px; }

.service-panel, .form-card, .result-section, .stock-content {
  margin-top: 18px;
  border: 1px solid rgba(207, 216, 232, 0.84);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}
.service-panel { padding: clamp(22px, 4vw, 34px); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading p, .view-header p { margin-bottom: 0; color: var(--muted); }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-card {
  display: flex;
  min-height: 94px;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 12px 22px rgba(56, 81, 136, 0.15);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.service-card:hover { transform: translateY(-2px); box-shadow: 0 16px 28px rgba(56, 81, 136, 0.2); }
.service-card.blue { background: linear-gradient(110deg, #3b82f6, #7c3aed); }
.service-card.cyan { background: linear-gradient(110deg, #0891b2, #2563eb); }
.service-card.violet { background: linear-gradient(110deg, #a855f7, #7c3aed); }
.service-card.orange { background: linear-gradient(110deg, #f97316, #e11d48); }
.service-card.emerald { background: linear-gradient(110deg, #059669, #0891b2); }
.service-card.teal { background: linear-gradient(110deg, #0f766e, #2563eb); }
.service-icon { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, 0.16); font-size: 21px; }
.service-card strong, .service-card small { display: block; }
.service-card strong { font-size: 16px; }
.service-card small { margin-top: 3px; color: rgba(255, 255, 255, 0.8); }

.view-header { display: grid; grid-template-columns: 130px 1fr; gap: 18px; align-items: start; margin-bottom: 26px; }
.view-header h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 38px); }
.back-link { display: inline-flex; min-height: 40px; align-items: center; color: #475569; font-weight: 650; }
.back-link:hover { color: var(--primary-dark); }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; }
.stepper li { position: relative; display: flex; align-items: center; gap: 8px; color: #8b97aa; font-size: 13px; font-weight: 700; }
.stepper b { font: inherit; }
.stepper li:not(:last-child)::after { height: 2px; flex: 1; margin-right: 8px; background: #d9e1ee; content: ""; }
.stepper span { display: grid; flex: 0 0 30px; height: 30px; place-items: center; border-radius: 50%; background: #dfe5ee; color: #64748b; }
.stepper li.current, .stepper li.done { color: var(--primary-dark); }
.stepper li.current span { background: var(--primary); color: #fff; box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.12); }
.stepper li.done span { background: #dbeafe; color: var(--primary-dark); }
.stepper li.done::after { background: #93c5fd; }
.form-card { padding: clamp(22px, 4vw, 34px); }
.field + .field { margin-top: 18px; }
.field label { display: block; margin-bottom: 7px; font-weight: 720; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 750;
}
form > .primary-button { width: 100%; margin-top: 22px; }
.primary-button { background: linear-gradient(100deg, var(--primary), var(--violet)); color: #fff; box-shadow: 0 9px 20px rgba(59, 130, 246, 0.2); }
.primary-button:hover { filter: brightness(0.98); }
.secondary-button { border: 1px solid #ccd6e5; background: #fff; color: #42526a; }
.secondary-button.compact { min-height: 40px; padding: 0 14px; }
.danger-button { background: var(--danger); color: #fff; }
.button-row { display: flex; justify-content: flex-end; gap: 11px; margin-top: 24px; }
.button-row .primary-button { min-width: 190px; }
.verified-card, .confirmation-summary, .order-card { border: 1px solid #d8e5f8; border-radius: 12px; background: #f6f9ff; padding: 18px; }
.summary-grid, .order-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.summary-item small, .order-grid dt { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.summary-item strong, .order-grid dd { margin: 0; overflow-wrap: anywhere; }
.notice { margin-top: 18px; padding: 14px 16px; border-radius: 11px; }
.notice p { margin: 4px 0 0; }
.notice.warning { border: 1px solid #f7d89a; background: #fffaf0; color: #8a4b0c; }
.notice.info { border: 1px solid #bfdbfe; background: #f0f7ff; color: #31588f; }
.inline-error { margin-top: 17px; padding: 13px 15px; border: 1px solid #fecaca; border-radius: 10px; background: #fff5f5; color: #b42318; }
.loading-state { display: flex; min-height: 140px; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid #d9e4f5; border-top-color: var(--primary); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-section, .stock-content { padding: clamp(18px, 3vw, 28px); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); }
.empty-state { padding: 42px 18px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 17px; }
.empty-state p { margin: 5px 0 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f6f8fc; color: #58667c; font-size: 12px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: #eef2f7; color: #59677c; font-size: 12px; font-weight: 750; }
.status-badge.success, .status-badge.available { background: #e8f8f1; color: #087a55; }
.status-badge.neutral { background: #eef2f7; color: #536176; }
.status-badge.pending, .status-badge.processing { background: #edf4ff; color: #2563eb; }
.status-badge.failed, .status-badge.disabled, .status-badge.missing { background: #fff0f0; color: #b42318; }
.status-badge.unknown, .status-badge.awaiting_confirmation { background: #fff7e6; color: #9a5709; }
.stock-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.stock-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.stock-card small { display: block; color: var(--muted); }
.stock-card strong { display: block; margin-top: 5px; font-size: 27px; }
.stock-card.total { background: linear-gradient(135deg, #edf5ff, #f2efff); border-color: #cadcf8; }
.subscription-form-card { max-width: none; }
.subscription-form-card textarea { min-height: 132px; }
.subscription-form-footer { display: flex; align-items: flex-end; justify-content: flex-end; gap: 24px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.subscription-actions { flex: 0 0 auto; margin: 0; }
.subscription-actions .action-query, .subscription-actions .action-refresh { min-width: 152px; }
.subscription-actions .action-refresh { background: linear-gradient(100deg, #059669, #0891b2); }
#subscriptionResult { border: 0; background: transparent; box-shadow: none; padding: 0; }
.subscription-result-heading { align-items: end; margin: 22px 4px 12px; }
.subscription-result-heading h2 { font-size: 19px; }
.subscription-result-heading p, .subscription-result-heading small { font-size: 12px; }
.subscription-card { overflow: hidden; border: 1px solid rgba(207, 216, 232, 0.92); border-radius: 16px; background: rgba(255, 255, 255, 0.96); box-shadow: var(--shadow-soft); }
.subscription-card + .subscription-card { margin-top: 14px; }
.subscription-card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.subscription-card.is-paid .subscription-card-header { background: linear-gradient(110deg, #f0fdf8, #effcff); }
.subscription-card.is-free .subscription-card-header { background: #f8fafc; }
.subscription-plan-summary { display: flex; min-width: 0; align-items: center; gap: 12px; }
.subscription-plan-summary small, .subscription-plan-summary strong { display: block; }
.subscription-plan-summary small { margin-bottom: 1px; color: var(--muted); font-size: 11px; }
.subscription-plan-summary strong { font-size: 17px; line-height: 1.3; }
.subscription-plan-mark { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #059669, #0891b2); color: #fff; font-size: 18px; font-weight: 800; }
.subscription-card.is-free .subscription-plan-mark { background: #64748b; }
.subscription-details { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
.subscription-card.is-free .subscription-details { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.subscription-details > div { min-width: 0; padding: 16px 20px; }
.subscription-details > div + div { border-left: 1px solid var(--line); }
.subscription-card dt { color: var(--muted); font-size: 11px; }
.subscription-card dd { margin: 3px 0 0; overflow-wrap: anywhere; color: #243047; font-weight: 720; }
.subscription-availability-note { margin: 0; padding: 10px 20px; border-top: 1px solid #fde7bd; background: #fffbeb; color: #8a5a08; font-size: 12px; line-height: 1.55; }

dialog { width: min(480px, calc(100% - 34px)); border: 0; border-radius: 17px; padding: 0; box-shadow: 0 30px 80px rgba(30, 41, 59, 0.3); }
dialog::backdrop { background: rgba(15, 23, 42, 0.58); backdrop-filter: blur(3px); }
.dialog-body { padding: 28px; text-align: center; }
.dialog-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 13px; place-items: center; border-radius: 50%; background: #fff2dd; color: #b45309; font-size: 22px; font-weight: 800; }
.dialog-body > p { color: var(--muted); }
.dialog-body dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 13px; margin: 18px 0 0; padding: 13px; border-radius: 10px; background: #f7f9fc; text-align: left; }
.dialog-body dt { color: var(--muted); }
.dialog-body dd { margin: 0; overflow-wrap: anywhere; }
.dialog-body .button-row { justify-content: center; }

footer { padding: 24px 20px 38px; color: #7d899b; text-align: center; font-size: 12px; }
footer p { margin: 3px 0; }

@media (max-width: 900px) {
  .subscription-details, .subscription-card.is-free .subscription-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subscription-details > div:nth-child(odd) { border-left: 0; }
  .subscription-details > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .main { width: min(100% - 24px, 940px); padding-top: 20px; }
  .hero-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "eyebrow aside"
      "title title";
    row-gap: 6px;
    padding: 22px;
    border-radius: 14px;
  }
  .hero-card h1 { margin-bottom: 0; font-size: 27px; }
  .language-control > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .language-control select { min-width: 124px; }
  .service-grid { grid-template-columns: 1fr; }
  .service-card { min-height: 82px; }
  .view-header { grid-template-columns: 1fr; gap: 7px; }
  .view-header .back-link { width: fit-content; }
  .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stepper li { justify-content: center; font-size: 0; }
  .stepper li:not(:last-child)::after { position: absolute; left: calc(50% + 18px); right: calc(-50% + 18px); margin: 0; }
  .stepper span { position: relative; z-index: 1; font-size: 13px; }
  .form-card { margin-top: 18px; }
  .summary-grid, .order-grid, .stock-grid { grid-template-columns: 1fr; }
  .subscription-form-footer { display: block; }
  .subscription-details, .subscription-card.is-free .subscription-details { grid-template-columns: 1fr; }
  .subscription-details > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .button-row { flex-direction: column-reverse; }
  .button-row > * { width: 100%; }
  .toolbar { align-items: flex-start; }
}
