:root {
  --bg: #171b20;
  --bg-2: #1c2127;
  --panel: rgba(34, 39, 46, 0.96);
  --panel-2: rgba(40, 46, 54, 0.98);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf3;
  --text-strong: #f6f8fb;
  --muted: #9ba6b2;
  --muted-2: #75808d;
  --danger: #d66b6b;
  --danger-bg: rgba(214, 107, 107, 0.14);
  --success: #bfc8d4;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.03), transparent 24%),
    linear-gradient(180deg, #171b20 0%, #1b2026 50%, #20262d 100%);
}

body {
  overflow-x: hidden;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.admin-shell {
  min-height: 100vh;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 0 0;
  backdrop-filter: blur(12px);
}

.admin-header-inner {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 28px;
  background: rgba(28, 33, 39, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text-strong);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-header-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-strong);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.admin-header-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.admin-header-btn.ghost {
  color: var(--muted);
}

.admin-header-btn.danger {
  color: #ffd6d6;
  border-color: rgba(214, 107, 107, 0.25);
  background: var(--danger-bg);
}

.admin-file-btn {
  position: relative;
  overflow: hidden;
}

.admin-main {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.admin-topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-topbar-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-topbar-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-topbar-card strong {
  font-size: 28px;
  color: var(--text-strong);
}

.admin-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar,
.admin-content {
  min-width: 0;
}

.admin-content {
  display: grid;
  gap: 18px;
}

.admin-panel {
  padding: 22px;
  border-radius: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-panel-head {
  margin-bottom: 18px;
}

.admin-panel-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
  color: var(--text-strong);
}

.admin-panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-search-wrap {
  margin-bottom: 14px;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-input,
.admin-select,
.admin-raw-output {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-strong);
  outline: none;
}

.admin-input::placeholder,
.admin-raw-output::placeholder {
  color: var(--muted-2);
}

.admin-input:focus,
.admin-select:focus,
.admin-raw-output:focus {
  border-color: var(--line-strong);
}

.admin-list-head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-list-head strong {
  font-size: 16px;
  color: var(--text-strong);
}

.admin-products-list {
  display: grid;
  gap: 10px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.admin-products-list::-webkit-scrollbar {
  width: 8px;
}

.admin-products-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.admin-product-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: 0.18s ease;
}

.admin-product-item:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
}

.admin-product-item.active {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.admin-product-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-product-item-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text-strong);
}

.admin-product-item-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-product-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-mini-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-strong);
  font-weight: 700;
}

.admin-mini-btn.danger {
  color: #ffd9d9;
  border-color: rgba(214, 107, 107, 0.28);
  background: rgba(214, 107, 107, 0.12);
}

.admin-form {
  display: grid;
  gap: 18px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.admin-form-col {
  grid-column: span 4;
  min-width: 0;
}

.admin-form-col-wide {
  grid-column: span 8;
  min-width: 0;
}

.admin-form-col-full {
  grid-column: 1 / -1;
  min-width: 0;
}

.admin-form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-primary-btn,
.admin-secondary-btn,
.admin-danger-btn {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 800;
}

.admin-primary-btn {
  background: linear-gradient(180deg, #eceff4, #cfd6df);
  color: #141920;
}

.admin-secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-strong);
  border: 1px solid var(--line);
}

.admin-danger-btn {
  background: rgba(214, 107, 107, 0.12);
  color: #ffd6d6;
  border: 1px solid rgba(214, 107, 107, 0.28);
}

.admin-preview-wrap {
  min-height: 280px;
  display: grid;
  place-items: start;
}

.admin-preview-card {
  width: min(100%, 340px);
  overflow: hidden;
  border-radius: 24px;
  background: rgba(40, 46, 54, 0.96);
  border: 1px solid var(--line);
}

.admin-preview-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.admin-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-preview-body {
  padding: 16px;
}

.admin-preview-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-preview-badges span {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-strong);
}

.admin-preview-title {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text-strong);
}

.admin-preview-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-strong);
}

.admin-preview-links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.admin-preview-links a {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-strong);
  font-weight: 700;
}

.admin-raw-output {
  min-height: 320px;
  resize: vertical;
  padding: 14px 16px;
  line-height: 1.6;
}

.admin-empty-list,
.admin-empty-preview {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

@media (max-width: 1180px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-header-inner,
  .admin-main {
    width: min(100%, calc(100% - 20px));
  }

  .admin-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header-actions {
    width: 100%;
  }

  .admin-header-btn {
    flex: 1 1 calc(50% - 10px);
  }

  .admin-topbar {
    grid-template-columns: 1fr;
  }

  .admin-filter-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-col,
  .admin-form-col-wide,
  .admin-form-col-full {
    grid-column: auto;
  }

  .admin-form-actions {
    flex-direction: column;
  }

  .admin-primary-btn,
  .admin-secondary-btn,
  .admin-danger-btn {
    width: 100%;
  }

  .admin-list-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-product-item-head {
    flex-direction: column;
  }

  .admin-product-item-actions {
    width: 100%;
  }

  .admin-mini-btn {
    flex: 1;
  }

  .admin-preview-links {
    flex-direction: column;
  }

  .admin-preview-links a {
    width: 100%;
  }
}