body { font-family: Arial, sans-serif; margin: 0; background: #f3f5f8; color: #1f2937; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.header-bar, .site-footer { background: #fff; border-bottom: 1px solid #e5e7eb; }
.site-footer { border-top: 1px solid #e5e7eb; border-bottom: 0; margin-top: 24px; }
.header-inner, .footer-inner {width:90%; margin: 0 auto; padding: 16px 20px; }
.top-nav { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.error { background: #ffe5e5; color: #a40000; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.success { background: #e7f8ea; color: #12652a; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
form.inline { display: inline; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }

:root {
  --btn-bg: #000000;
  --btn-color: #ffffff;
  --btn-hover-bg: #1a1a1a;
  --btn-border: transparent;
  --btn-radius: 6px;          /* 4px – строго, 999px – «пилюля» */
  --btn-padding: 0.875rem 2rem;
  --btn-font-size: 0.875rem;  /* 14px */
  --btn-font-weight: 600;
  --btn-letter-spacing: 0.04em;
  --btn-transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --auth-card-bg: #ffffff;
  --auth-card-border: #e5e7eb;
  --auth-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --auth-card-radius: 14px;
  
  --auth-input-border: #d1d5db;
  --auth-input-bg: #f9fafb;
  --auth-input-focus: #0f172a;
  --auth-input-focus-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
  
  --auth-label-color: #6b7280;
  --auth-text-color: #111827;
  
  --auth-error-bg: #fef2f2;
  --auth-error-color: #b91c1c;
  --auth-error-border: #fecaca;
  
  --auth-spacing: 1rem;
}

.tilda-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--btn-padding);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: var(--btn-letter-spacing);
  color: var(--btn-color);
  background-color: var(--btn-bg);
  border: 2px solid var(--btn-border);
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: var(--btn-transition);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

/* Hover */
.tilda-btn:hover {
  background-color: var(--btn-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Focus (доступность) */
.tilda-btn:focus-visible {
  outline: 3px solid #0055ff;
  outline-offset: 2px;
}

/* Active / Click */
.tilda-btn:active {
  transform: translateY(0);
  background-color: var(--btn-bg);
  box-shadow: none;
}

/* 🔹 Контурная (Ghost) */
.tilda-btn--outline {
  --btn-bg: transparent;
  --btn-color: #000000;
  --btn-border: #000000;
}
.tilda-btn--outline:hover {
  background-color: #000000;
  color: #ffffff;
}

/* 🔹 Светлая (для тёмного фона) */
.tilda-btn--light {
  --btn-bg: #ffffff;
  --btn-color: #000000;
  --btn-border: #ffffff;
  --btn-hover-bg: #f5f5f5;
}
.tilda-btn--light:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 🔹 Отключённое состояние */
.tilda-btn:disabled,
.tilda-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

.header-bar {
  display: flex;
  align-items: center;       /* Центрирование по вертикали */
  justify-content: space-between; /* Раскидывает элементы по краям */
  padding: 1rem 2rem;
}

.header-bar {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

/* Магия точного позиционирования */
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* Лево | Авто-ширина центра | Право */
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
}

/* ЛЕВАЯ ЗОНА */
.brand {
  justify-self: start;
}
.brand a {
  text-decoration: none;
  color: #0f172a;
  font-weight: 700;
  font-size: 1.125rem;
}

/* ЦЕНТРАЛЬНАЯ ЗОНА */
.top-nav {
  justify-self: center;
  display: flex;
  gap: 1.5rem;
}
.top-nav a {
  text-decoration: none;
  color: #4b5563;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}
.top-nav a:hover { color: #000; }

/* ПРАВАЯ ЗОНА */
.inline {
  justify-self: end;
  margin: 0; /* Убираем дефолтный margin у <form> */
}

/* Компактная версия кнопки */
.tilda-btn--sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.75rem;
}

.green-btn{ background-color: #046906;}
.red-btn{background-color: #bb0909;}
.grey-btn{background-color: #606360;}

.storageTable td {
    padding: 1px 12px;
    font-size: 0.95rem;
}

.batchesTable td {
    padding: 1px 12px;
    font-size: 0.95rem;
}

.batchItemsTable td{
    padding: 1px 12px;
    font-size: 0.85rem; 
}


/* Карточка */
.auth-card {
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  border-radius: var(--auth-card-radius);
  box-shadow: var(--auth-card-shadow);
  padding: 2.25rem 2rem;
  max-width: 420px;
  margin: 80px auto;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.auth-card__title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--auth-text-color);
  text-align: center;
  letter-spacing: -0.02em;
}

/* Ошибка */
.auth-card__error {
  background: var(--auth-error-bg);
  color: var(--auth-error-color);
  border: 1px solid var(--auth-error-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

/* Форма */
.auth-form__group {
  margin-bottom: var(--auth-spacing);
}

.auth-form__label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--auth-label-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-form__input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font-size: 0.9375rem;
  color: var(--auth-text-color);
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-input-border);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  font-family: inherit;
}

.auth-form__input:hover {
  border-color: #9ca3af;
  background: #ffffff;
}

.auth-form__input:focus {
  border-color: var(--auth-input-focus);
  background: #ffffff;
  box-shadow: var(--auth-input-focus-shadow);
}

.auth-form__input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

/* Кнопка на всю ширину */
.auth-form__submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

/* Мобильная адаптация */
@media (max-width: 480px) {
  .auth-card {
    margin: 40px 16px;
    padding: 1.75rem 1.25rem;
    border-radius: 12px;
  }
}

/* ===== Blocks admin: additive styles ===== */

.warning {
  background: #fff7e6;
  color: #8a5a00;
  border: 1px solid #f4d08a;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.muted {
  color: #6b7280;
}

.blocksTable {
  width: 100%;
  border-collapse: collapse;
}

.blocksTable th,
.blocksTable td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.blocksTable th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge--active {
  background: #e7f8ea;
  color: #12652a;
  border: 1px solid #b8e0bf;
}

.status-badge--inactive {
  background: #fde6e6; /*#f3f4f6;*/
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.link-danger {
  background: none;
  border: 0;
  padding: 0;
  color: #b42318;
  cursor: pointer;
  font: inherit;
}

.admin-form {
  max-width: 900px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.form-field--full {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 600;
}

.form-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
}

.form-field input:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.field-hint {
  font-size: 13px;
  color: #6b7280;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
}

.checkbox-row input {
  margin-top: 2px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

code {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px 6px;
}

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

  .nav {
    gap: 16px;
    align-items: flex-start;
    flex-direction: column;
  }
}


/* ===== Material types admin: additive styles ===== */

.materialTypesTable {
  width: 100%;
  border-collapse: collapse;
}

.materialTypesTable th,
.materialTypesTable td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.materialTypesTable th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

/* ===== Shop categories admin ===== */

.shop-categories-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
  font: inherit;
}

.form-field select:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.shop-tree-card {
  margin-top: 24px;
}

.shop-tree-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.shop-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shop-tree--children {
  margin-top: 8px;
  margin-left: 28px;
  padding-left: 18px;
  border-left: 2px solid #e5e7eb;
}

.shop-tree__node {
  position: relative;
  margin: 0 0 10px;
}

.shop-tree__node:last-child {
  margin-bottom: 0;
}

.shop-tree__row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.shop-tree__row:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.shop-tree__branch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #111827;
  display: inline-block;
}

.shop-tree__node--subcategory .shop-tree__branch {
  background: #6b7280;
}

.shop-tree__link {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #111827;
  text-decoration: none;
}

.shop-tree__title {
  font-weight: 700;
  line-height: 1.25;
}

.shop-tree__meta {
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shop-tree__node--inactive .shop-tree__row {
  background: #f9fafb;
  border-style: dashed;
}

.shop-tree__node--inactive .shop-tree__title {
  color: #6b7280;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.shop-tree__node--inactive .shop-tree__meta {
  color: #9ca3af;
}

.shop-tree__empty-child {
  margin: 8px 0 0 46px;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .shop-categories-layout {
    grid-template-columns: 1fr;
  }

  .shop-tree__row {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .shop-tree__row .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .shop-tree--children {
    margin-left: 14px;
    padding-left: 14px;
  }
}

/* ===== Admin grouped top navigation ===== */

.admin-nav-sections {
  align-items: stretch;
  gap: 1rem;
}

.admin-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-left: 1px solid #e5e7eb;
}

.admin-nav-section:first-child {
  border-left: 0;
}

.admin-nav-section__label {
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bb0909;
}

.admin-nav-section--active .admin-nav-section__label {
  /*color: #111827;*/
}

.admin-nav-section__items {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.top-nav .admin-nav-link {
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.top-nav .admin-nav-link:hover {
  color: #000;
}

.top-nav .admin-nav-link--active {
  color: #000;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .header-inner {
    height: auto;
    min-height: 64px;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    gap: 1rem;
  }

  .admin-nav-sections {
    justify-self: stretch;
    justify-content: center;
  }

  .admin-nav-section {
    border-left: 0;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.65rem;
  }
}

@media (max-width: 760px) {
  .header-inner {
    grid-template-columns: 1fr;
  }

  .brand,
  .top-nav,
  .inline {
    justify-self: stretch;
  }

  .admin-nav-sections {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-nav-section__items {
    gap: 0.65rem;
  }

  .inline {
    display: flex;
    justify-content: flex-start;
  }
}

/* ===== Shop products admin ===== */

.admin-form--wide {
  max-width: 1100px;
}

.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
  font: inherit;
}

.form-field textarea {
  resize: vertical;
  min-height: 140px;
}

.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.shop-products-table {
  width: 100%;
  border-collapse: collapse;
}

.shop-products-table th,
.shop-products-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.shop-products-table th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.shop-products-table td {
  font-size: 0.92rem;
}

.status-badge--draft {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.status-badge--hidden {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

@media (max-width: 900px) {
  .shop-products-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ===== Shop product files admin ===== */

.shop-product-files {
  display: grid;
  gap: 18px;
}

.shop-product-files-table {
  width: 100%;
  border-collapse: collapse;
}

.shop-product-files-table th,
.shop-product-files-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.shop-product-files-table th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.shop-product-file-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.shop-product-upload-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.shop-product-upload-card h3 {
  margin: 0;
}

.shop-product-upload-card input[type="file"],
.shop-product-upload-card input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .shop-product-file-upload-grid {
    grid-template-columns: 1fr;
  }

  .shop-product-files-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
/* Shop product series */
.admin-form--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
}

.admin-form--inline .form-field {
  min-width: 220px;
  margin-bottom: 0;
}

.shop-series-table,
.shop-products-table {
  width: 100%;
}

.admin-inline-edit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-inline-edit-form input[type="text"] {
  min-width: 260px;
}

.admin-inline-edit-form input[type="number"] {
  width: 96px;
}

.is-inactive-row {
  opacity: .62;
  background: #f9fafb;
}

/* Shop promo codes */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.promo-settings-card {
  display: grid;
  gap: 14px;
}

.promo-settings-card__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.promo-settings-card__status {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.form-grid--promo {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.promo-create-actions {
  align-self: end;
}

.shop-promo-codes-table {
  width: 100%;
  border-collapse: collapse;
}

.shop-promo-codes-table th,
.shop-promo-codes-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.shop-promo-codes-table th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.promo-code-fields,
.promo-dates-grid,
.promo-uses-grid {
  display: grid;
  gap: 8px;
}

.promo-code-fields {
  grid-template-columns: minmax(180px, 1fr) 110px;
}

.promo-dates-grid label {
  display: grid;
  grid-template-columns: 22px minmax(190px, 1fr);
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 13px;
}

.promo-code-fields input,
.promo-dates-grid input,
.promo-uses-grid input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
}

.promo-uses-grid {
  min-width: 130px;
}

.promo-date-note {
  margin-top: 6px;
  font-size: 12px;
}

.promo-code-actions {
  align-items: flex-start;
}

@media (max-width: 1100px) {
  .shop-promo-codes-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

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

@media (max-width: 700px) {
  .form-grid--promo,
  .promo-code-fields {
    grid-template-columns: 1fr;
  }

  .promo-settings-card__body {
    align-items: stretch;
  }
}
