﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --brand:       #0f79d8;
  --brand-hover: #0d6abf;
  --brand-pale:  #e8f2fd;
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --line:        #e5eaf2;
  --text:        #1a1f2e;
  --muted:       #6b7a99;
  --success:     #0d7a4a;
  --error:       #c0192e;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow-sm:   0 2px 8px rgba(15,30,70,.07);
  --shadow:      0 4px 20px rgba(15,30,70,.10);
  --shadow-md:   0 8px 32px rgba(15,30,70,.12);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }

.qrBillApp {
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.qrBillApp__top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.qrBillApp__topInner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qrBillApp__brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.qrBillApp__brand span { color: var(--text); }

.qrBillApp__topActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qrBillApp__lang { position: relative; }

.qrBillApp__lang summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: border-color .18s, background .18s;
}

.qrBillApp__lang summary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-pale);
}

.qrBillApp__langMenu {
  position: absolute;
  right: 0;
  top: 40px;
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 20;
}

.qrBillApp__langMenu a {
  display: block;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background .15s, color .15s;
}

.qrBillApp__langMenu a:hover {
  background: var(--brand-pale);
  color: var(--brand);
}

.stepBar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
}

.stepBar__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
}

.stepBar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .2s;
  white-space: nowrap;
}

.stepBar__item.is-active { color: var(--brand); }
.stepBar__item.is-done { color: var(--success); }

.stepBar__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background .2s, color .2s, border-color .2s;
}

.stepBar__item.is-active .stepBar__num {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.stepBar__item.is-done .stepBar__num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.stepBar__sep {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 12px;
  border-radius: 2px;
  min-width: 24px;
  max-width: 100px;
}

.wizardStep { display: none; }
.wizardStep.is-active { display: block; }

.qrBillHero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 48px 24px 44px;
  text-align: center;
}

.qrBillHero__inner {
  max-width: 740px;
  margin: 0 auto;
}

.qrBillHero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.qrBillHero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.6;
}

.qrBillBuilder {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

.builderGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.settingsCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settingsCard__head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.settingsCard__head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.settingsCard__head p {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.settingsCard__body {
  padding: 18px 20px 20px;
}

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

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #374151;
}

.field__hint {
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}

.field__error {
  margin-top: 6px;
  min-height: 16px;
  color: var(--error);
  font-size: 0.78rem;
  font-weight: 600;
}

.split2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.split2.compact {
  margin-top: 8px;
}

.input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a99' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,121,216,.14);
}

.is-invalid .input,
.input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(192,25,46,.12);
}

.formMsg {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid #f5c0c8;
  background: #fff5f6;
  color: var(--error);
  font-size: 0.82rem;
  font-weight: 600;
}

.hidden { display: none; }

.statusBar {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  transition: background .2s, color .2s, border-color .2s;
}

.statusBar.is-error {
  background: #fff5f6;
  color: var(--error);
  border-color: #f5c0c8;
}

.statusBar.is-ok {
  background: #f0faf6;
  color: var(--success);
  border-color: #b3e0c9;
}

.actionBar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.previewWrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  min-height: 420px;
  padding: 12px;
  overflow: auto;
}

.previewPlaceholder {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px dashed #c5d8f5;
  border-radius: 10px;
}

.previewSheet {
  background: #fff;
  border: 1px solid #d6dde9;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15,30,70,.06);
  overflow: hidden;
}

.previewCanvas {
  width: 100%;
  display: block;
  height: auto;
}

.qrBillDownload {
  max-width: 560px;
  margin: 60px auto 0;
  padding: 0 24px 60px;
  text-align: center;
}

.downloadSuccess__icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 16px;
  font-weight: 800;
  color: var(--success);
}

.downloadSuccess__title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}

.downloadSuccess__sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 32px;
}

.downloadCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  text-align: left;
}

.downloadCard__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--line);
}

.downloadCard__row:last-child { border-bottom: none; }
.downloadCard__row:nth-child(even) { background: var(--surface-2); }

.downloadCard__label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.downloadCard__value {
  font-weight: 700;
  color: var(--text);
  font-size: 0.88rem;
  text-align: right;
  max-width: 70%;
  word-break: break-all;
}

.downloadActions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.newFileLink {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.newFileLink:hover { color: var(--brand-hover); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
  width: 100%;
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid rgba(15,121,216,.3);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: rgba(10,55,130,.2);
  box-shadow: 0 2px 8px rgba(15,121,216,.22);
}

.btn--primary:hover:not(:disabled) {
  background: var(--brand-hover);
  box-shadow: 0 4px 14px rgba(15,121,216,.30);
}

.btn--primary:active:not(:disabled) { transform: scale(0.98); }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--line);
  color: var(--text);
}

.btn--sm {
  width: auto;
  min-height: 38px;
  padding: 7px 14px;
  font-size: 0.85rem;
}

@media (max-width: 980px) {
  .builderGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .qrBillApp__topInner { padding: 0 16px; }
  .qrBillHero { padding: 32px 16px 28px; }
  .qrBillBuilder { padding: 20px 16px 32px; }
  .settingsCard__head,
  .settingsCard__body { padding-left: 16px; padding-right: 16px; }
  .split2 { grid-template-columns: 1fr; }
  .previewWrap { min-height: 300px; }
  .qrBillDownload { margin-top: 32px; padding: 0 16px 40px; }
  .stepBar__label { display: none; }
  .stepBar__sep { max-width: 40px; }
}
