:root {
  color-scheme: light;
  --paper: #f7f8f2;
  --surface: #ffffff;
  --surface-soft: #fbfcf7;
  --surface-glass: rgba(255, 255, 255, 0.78);
  --section-glass: rgba(255, 255, 255, 0.68);
  --empty-glass: rgba(255, 255, 255, 0.55);
  --ink: #161713;
  --muted: #6d7068;
  --line: #dfe2d6;
  --accent: #bfd94e;
  --accent-strong: #6d8421;
  --coral: #f35f45;
  --aqua: #1d9aa6;
  --shadow: 0 18px 50px rgba(22, 23, 19, 0.08);
  --radius: 8px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --paper: #11130f;
  --surface: #191c16;
  --surface-soft: #20241b;
  --surface-glass: rgba(25, 28, 22, 0.82);
  --section-glass: rgba(25, 28, 22, 0.72);
  --empty-glass: rgba(25, 28, 22, 0.62);
  --ink: #f4f5ed;
  --muted: #a9aea0;
  --line: #343a2f;
  --accent: #c6e056;
  --accent-strong: #d7f06f;
  --coral: #ff7a62;
  --aqua: #63cbd3;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(191, 217, 78, 0.2), transparent 36%),
    linear-gradient(315deg, rgba(29, 154, 166, 0.12), transparent 30%),
    var(--paper);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  min-height: 100vh;
  transition: background 180ms ease, color 180ms ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Instrument Sans", sans-serif;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

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

.icon-button,
.ghost-button,
.primary-button,
.inline-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  min-height: 42px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
}

.ghost-button,
.primary-button,
.inline-control button {
  padding: 0 15px;
}

.primary-button,
.inline-control button {
  background: var(--ink);
  color: var(--paper);
}

.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.inline-control button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(22, 23, 19, 0.12);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.summary-strip article {
  padding: 18px;
  background: var(--surface-glass);
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.summary-strip strong {
  display: block;
  margin-top: 5px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.8rem;
}

.admin-panel {
  margin-bottom: 24px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-lock,
.admin-tools {
  padding: 20px;
}

.admin-lock,
.admin-heading,
.form-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.pin-form {
  min-width: min(380px, 100%);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(29, 154, 166, 0.16);
}

textarea {
  min-height: 330px;
  padding: 14px;
  line-height: 1.5;
  resize: vertical;
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.form-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.settings-card,
.module-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 18px;
}

.settings-card p {
  margin-bottom: 18px;
  color: var(--muted);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 92px auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent-strong);
}

.module-form {
  margin-top: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 22px;
}

.search-box {
  position: relative;
}

.search-box i,
.search-box svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-box input {
  padding-left: 42px;
}

.catalog {
  display: grid;
  gap: 18px;
}

.brand-section {
  border-top: 3px solid var(--ink);
  background: var(--section-glass);
}

.brand-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 4px 12px;
}

.brand-header h2 {
  font-size: clamp(1.45rem, 3vw, 2.5rem);
}

.brand-count {
  color: var(--muted);
  font-weight: 700;
}

.brand-actions {
  display: flex;
  gap: 8px;
}

.brand-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.brand-action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(22, 23, 19, 0.12);
}

.module-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.module-row {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.module-main strong {
  display: block;
  font-size: 1rem;
}

.module-main span,
.price-block span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.price-block {
  text-align: right;
}

.price-block strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
}

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

.row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.row-button.delete {
  color: var(--coral);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 38px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  background: var(--empty-glass);
}

.empty-state i,
.empty-state svg {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: var(--aqua);
}

.empty-state p {
  max-width: 430px;
  margin-bottom: 0;
  color: var(--muted);
}

.text-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(22, 23, 19, 0.42);
  backdrop-filter: blur(10px);
}

.text-modal-content {
  display: grid;
  gap: 16px;
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  padding: 20px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.text-modal-header,
.text-modal-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.text-modal-actions {
  align-items: center;
}

.text-modal-actions > div {
  display: flex;
  gap: 8px;
}

.is-hidden {
  display: none !important;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .admin-lock,
  .admin-heading,
  .form-title-row,
  .text-modal-header,
  .text-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .summary-strip,
  .settings-grid,
  .form-grid,
  .catalog-toolbar {
    grid-template-columns: 1fr;
  }

  .module-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .price-block {
    text-align: left;
  }

  .admin-actions {
    justify-content: flex-start;
  }

  .brand-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .text-modal-actions > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .topbar {
    min-height: auto;
    padding-bottom: 12px;
  }

  .topbar-actions,
  .admin-panel,
  .catalog-toolbar,
  .summary-strip,
  .text-modal,
  .brand-actions,
  .admin-actions,
  .cost-column {
    display: none !important;
  }

  h1 {
    font-size: 34px;
  }

  .brand-section {
    break-inside: avoid;
    background: white;
  }

  .module-row {
    grid-template-columns: 1.4fr 1fr;
    padding: 10px 12px;
  }

  .module-list,
  .module-row,
  .brand-section {
    border-color: #cfd4c6;
  }
}
