:root {
  --bg: #0d0d0d;
  --surface: #ffffff;
  --ink: #161616;
  --muted: #5f5f5f;
  --brand: #c40000;
  --brand-strong: #930000;
  --brand-dark: #1a1a1a;
  --accent: #ffe500;
  --line: #d9d9d9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 0, 0, 0.25), transparent 42%),
    linear-gradient(170deg, #1a1a1a 0%, #0d0d0d 100%);
}

.container {
  max-width: 980px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

.brand-strip {
  background: #ffffff;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-logo {
  width: 64px;
  height: 52px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 1.05rem;
  color: #151515;
}

.brand-copy span {
  color: #575757;
  font-size: 0.9rem;
}

.hero {
  margin-bottom: 16px;
  border-radius: 14px;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    linear-gradient(120deg, #b80000 0%, #e10000 55%, #930000 100%);
  border: 1px solid #810000;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
}

.hero h1 {
  color: #ffffff;
}

.title-with-icon {
  display: flex;
  gap: 10px;
  align-items: center;
}

.title-with-icon .material-symbols-outlined {
  font-size: 32px;
  color: var(--accent);
}

.hero p {
  color: #fff6f6;
  margin-top: 6px;
}

.hero-actions {
  margin-top: 12px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #111;
  background: var(--accent);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  font-weight: 700;
}

.page-link:hover {
  background: #f7d800;
}

.inline-help {
  margin-top: -4px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  background: #202020;
  color: #f2f2f2;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-btn.has-errors:not(.active) {
  border-color: #d10000;
  color: #ffdede;
}

.tab-panel {
  margin-bottom: 12px;
}

.firme-consents-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.firme-consents-row .card {
  margin-bottom: 0;
}

.card {
  background: #f3f3f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.section-title .material-symbols-outlined {
  font-size: 22px;
  color: var(--brand);
}

.section-tools {
  display: flex;
  gap: 8px;
}

.tool-btn {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand-strong);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-btn[hidden] {
  display: none !important;
}

.tool-btn:hover {
  background: var(--brand-strong);
}

.tool-btn:disabled {
  background: #d66363;
  color: #fff1f1;
  border-color: #b94e4e;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.grid.one {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.inline-field-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tool-btn-inline {
  width: 44px;
  min-width: 44px;
}


input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

input[readonly] {
  background: #ececec;
  color: #333;
  font-weight: 600;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #ffe161;
  border-color: transparent;
}

.pac-container {
  z-index: 2147483647 !important;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.pac-item {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.pac-item-query {
  font-size: 0.95rem;
}

.google-address-input {
  -webkit-text-size-adjust: 100%;
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: #d10000;
  background: #fff3f3;
}

.checkbox input.field-invalid {
  outline: 2px solid #d10000;
}

.field-error-text {
  display: block;
  margin-top: 4px;
  color: #c40000;
  font-size: 0.78rem;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #2a2a2a;
  color: #fff;
  margin-top: 10px;
}

button.secondary:hover {
  background: #111;
}

button:hover {
  background: #f7d800;
}

.with-icon {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tab-quick-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.actions {
  margin-top: 16px;
  margin-bottom: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1.6fr 0.6fr 0.8fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.row.contacts {
  grid-template-columns: 1.6fr 1fr auto;
}

.row.product-row {
  grid-template-columns: minmax(260px, 1.6fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) auto;
  grid-template-areas:
    "prod qty price remove"
    "meta meta meta remove";
  align-items: start;
  margin-bottom: 14px;
}

.row.product-row .field-product {
  grid-area: prod;
}

.row.product-row .field-qty {
  grid-area: qty;
}

.row.product-row .field-price {
  grid-area: price;
}

.row.product-row .field-remove {
  grid-area: remove;
  align-self: center;
  min-width: 44px;
}

.row.product-row .field-meta {
  grid-area: meta;
  margin-top: -2px;
}

.remove {
  background: #b83f3f;
  color: #fff;
  align-self: end;
  margin-top: 0;
}

.remove.icon-only {
  width: 44px;
  min-width: 44px;
  padding: 10px;
  justify-content: center;
  gap: 0;
}

.remove:hover {
  background: #9f2e2e;
}

.product-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.kit-secure-box {
  border: 1px solid #d5d5d5;
  background: #fcfcfc;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.kit-secure-box .inline-help {
  margin-top: 8px;
  margin-bottom: 0;
}

.price-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.price-summary-item {
  background: #fff;
  border: 1px solid #dadada;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.price-summary-item span {
  font-size: 0.82rem;
  color: #616161;
}

.price-summary-item strong {
  font-size: 1rem;
  color: #1a1a1a;
}

.price-summary-item.grand {
  background: #161616;
  border-color: #111;
}

.price-summary-item.grand span,
.price-summary-item.grand strong {
  color: #fff;
}

.signature {
  width: 100%;
  height: 160px;
  border: 1px dashed #9d9d9d;
  border-radius: 8px;
  background: #fff;
}

.signature.signature-invalid {
  border-color: #d10000;
  background: #fff3f3;
}

#result {
  background: #151515;
  color: #f8fafc;
  min-height: 58px;
  border-radius: 10px;
  padding: 12px;
  white-space: pre-wrap;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.config-grid {
  display: grid;
  gap: 10px;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #dfdfdf;
}

.config-row:last-child {
  border-bottom: 0;
}

.config-product {
  display: grid;
  gap: 4px;
}

.config-product strong {
  font-size: 0.95rem;
}

.config-product small {
  color: var(--muted);
}

.readonly-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ececec;
  color: #3a3a3a;
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 680px) {
  .brand-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .firme-consents-row {
    grid-template-columns: 1fr;
  }

  .row,
  .row.contacts {
    grid-template-columns: 1fr;
  }

  .grid.two-50 {
    grid-template-columns: 1fr;
  }

  .price-summary-grid {
    grid-template-columns: 1fr;
  }

  .row.product-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "prod"
      "qty"
      "price"
      "meta"
      "remove";
  }

  .row.product-row .field-remove {
    justify-self: start;
  }

  .tab-quick-nav {
    flex-direction: column;
  }

  .config-row {
    grid-template-columns: 1fr;
  }
}
