:root {
  color-scheme: light;
  --bg: #eef4fa;
  --ink: #18334f;
  --muted: #6a7a8c;
  --blue: #24476e;
  --brand: #8eaad0;
  --accent: #52a8d8;
  --soft: #f3f7fb;
  --line: #d7e2ee;
  --white: #ffffff;
  --danger: #d74c5a;
  --ok: #1e9f82;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Poppins, Arial, Helvetica, sans-serif;
}

.login-page {
  background: linear-gradient(135deg, var(--brand), var(--blue));
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(24, 51, 79, 0.28);
  display: grid;
  gap: 18px;
  max-width: 420px;
  padding: 28px;
  width: min(100%, 420px);
}

.login-card img {
  background: var(--brand);
  border-radius: 8px;
  display: block;
  padding: 18px;
  width: 190px;
}

.login-card h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.08;
  margin: 0;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.login-form input {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 12px;
  width: 100%;
}

.login-form p {
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  min-height: 18px;
  margin: 0;
}

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

button,
.import-button {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
}

button:hover,
.import-button:hover {
  border-color: var(--blue);
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

button.danger {
  border-color: #f0c4ca;
  color: var(--danger);
}

.readonly .admin-only {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 28px;
}

.app-header {
  align-items: center;
  background: var(--brand);
  border-bottom: 5px solid var(--blue);
  color: var(--white);
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(420px, 1fr) minmax(0, auto);
  padding: 18px 32px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 34px;
}

.brand img {
  display: block;
  width: 172px;
}

.brand span,
.brand h1 {
  margin: 0;
}

.brand span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.brand h1 {
  font-size: 30px;
  line-height: 1.1;
}

.top-actions,
.inline-actions,
.section-title,
.products-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 820px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  padding: 9px 12px;
}

.import-button {
  position: relative;
}

.import-button input {
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 18px 32px 0;
}

.season-strip {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 0.75fr) minmax(220px, 1fr) minmax(260px, 1.4fr) auto;
  margin: 18px 32px 0;
}

.summary article,
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary article {
  padding: 12px 14px;
}

.summary span,
.section-title p,
.fields label,
.plan-row label,
.search span,
.season-strip label,
.pdf-stats span,
.offer-body small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
}

.summary strong {
  display: block;
  font-size: 18px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: 330px minmax(0, 1fr);
  padding: 18px 32px 0;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.products-panel,
.preview-panel {
  align-self: start;
}

.products-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 178px);
  position: sticky;
  top: 18px;
}

.products-toolbar {
  margin-bottom: 10px;
}

.search {
  flex: 1;
}

.search input,
.season-strip input,
.season-strip select,
.create-user input,
.create-user select,
.user-row select,
.fields input,
.fields textarea,
.plan-row input,
.plan-row textarea {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
  width: 100%;
}

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

.search input {
  margin-top: 6px;
}

.product-list,
.editor-column,
.plan-list {
  display: grid;
  gap: 8px;
}

.product-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.product-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 22px minmax(0, 1fr) 48px;
  padding: 7px;
}

.product-item.active {
  border-color: var(--blue);
  box-shadow: inset 4px 0 0 var(--blue);
}

.product-select {
  background: transparent;
  border: 0;
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr);
  justify-content: start;
  min-height: 0;
  padding: 0;
  text-align: left;
}

.product-check {
  display: grid;
  place-items: center;
}

.product-check input {
  accent-color: var(--blue);
  height: 17px;
  width: 17px;
}

.selected-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin: -2px 0 8px;
}

.select-all {
  background: var(--soft);
  margin-bottom: 10px;
  min-height: 34px;
  width: 100%;
}

.product-select img {
  aspect-ratio: 1;
  background: #102431;
  border-radius: 7px;
  object-fit: cover;
  width: 42px;
}

.product-select strong,
.product-select small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-select strong {
  font-size: 12px;
}

.product-select small {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.mini-pdf {
  background: var(--soft);
  font-size: 11px;
  min-height: 33px;
  padding: 0;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-title h2 {
  font-size: 18px;
}

.product-form {
  display: grid;
  gap: 16px;
  grid-template-columns: 170px 1fr;
}

.thumb-box {
  display: grid;
  gap: 10px;
}

.thumb-box img {
  aspect-ratio: 0.78;
  background: #102431;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  width: 100%;
}

.thumb-box label {
  background: var(--soft);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--blue);
  cursor: pointer;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  min-height: 42px;
  place-items: center;
  position: relative;
}

.thumb-box input {
  inset: 0;
  opacity: 0;
  position: absolute;
}

.fields {
  display: grid;
  gap: 10px;
}

.fields label,
.plan-row label {
  display: grid;
  gap: 6px;
}

.fields textarea,
.plan-row textarea {
  resize: vertical;
}

.plan-row {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.1fr) minmax(240px, 1.2fr) 128px 88px;
  padding: 10px;
}

.plan-row.lowest {
  box-shadow: inset 4px 0 0 var(--ok);
}

.plan-row.top {
  border-color: var(--blue);
}

.line-pdf {
  background: var(--soft);
  grid-column: 4;
  grid-row: 2;
  min-height: 42px;
  width: 100%;
}

.plan-row .remove {
  grid-column: 5;
  grid-row: 2;
  min-height: 42px;
  width: 100%;
}

.preview-panel {
  grid-column: 2;
  overflow: hidden;
}

.admin-panel {
  overflow: hidden;
}

.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.admin-grid h3 {
  font-size: 14px;
  margin: 0 0 10px;
}

.create-user {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr) 150px 80px;
  margin-bottom: 10px;
}

.user-list,
.audit-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.user-row,
.audit-row {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.user-row {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 150px 86px;
}

.audit-row span,
.audit-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.audit-row strong {
  font-size: 12px;
}

.audit-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-page {
  aspect-ratio: 1.414 / 1;
  background: #f3f7fb;
  box-shadow: 0 18px 45px rgba(24, 51, 79, 0.16);
  color: var(--ink);
  display: grid;
  grid-template-rows: 48px auto 1fr 22px;
  max-width: 1180px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.empty-preview {
  color: var(--muted);
  display: grid;
  font-weight: 800;
  min-height: 260px;
  place-items: center;
}

.pdf-top {
  align-items: center;
  background: var(--brand);
  border-bottom: 4px solid var(--blue);
  display: flex;
  justify-content: space-between;
  padding: 0 28px;
}

.pdf-top img {
  width: 120px;
}

.pdf-top span {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  font-weight: 700;
}

.pdf-intro {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 72px auto;
  padding: 18px 28px 8px;
}

.pdf-intro h2,
.pdf-intro p {
  margin: 0;
}

.pdf-intro h2 {
  font-size: 30px;
  line-height: 1;
}

.pdf-intro p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.pdf-thumb {
  aspect-ratio: 0.78;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  width: 72px;
}

.pdf-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 90px);
}

.pdf-stats div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
}

.pdf-stats strong {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.pdf-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  padding: 6px 28px 2px;
}

.offer-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: 24px 1fr;
  overflow: hidden;
}

.offer-strip {
  align-items: center;
  background: var(--brand);
  color: #ffffff;
  display: flex;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.12;
  padding: 0 10px;
}

.top-card .offer-strip {
  background: var(--blue);
}

.offer-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  padding: 8px;
}

.offer-body h3 {
  font-size: 9px;
  line-height: 1.22;
  margin: 0;
}

.offer-desc {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
  margin: 4px 0 0;
}

.chips {
  align-content: end;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-height: 16px;
  overflow: hidden;
  padding: 2px 0 4px;
}

.chips span {
  background: #f3f7fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  line-height: 1.15;
  padding: 2px 6px;
}

.offer-body footer,
.pdf-footer {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.offer-body strong {
  display: block;
  font-size: 17px;
  line-height: 1.05;
}

.offer-body b {
  background: var(--accent);
  border-radius: 8px;
  color: #ffffff;
  font-size: 9px;
  padding: 5px 7px;
}

.pdf-footer {
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  padding: 0 28px 8px;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 300px 1fr;
  }

  .preview-panel {
    grid-column: 2;
  }

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

  .season-strip,
  .admin-grid,
  .create-user {
    grid-template-columns: 1fr 1fr;
  }

  .plan-row label:first-child,
  .plan-row label:nth-child(2),
  .plan-row label:nth-child(3) {
    grid-column: 1 / -1;
  }

  .line-pdf,
  .plan-row .remove {
    grid-row: auto;
  }

  .line-pdf {
    grid-column: 1;
  }

  .plan-row .remove {
    grid-column: 2;
  }
}

@media (max-width: 820px) {
  .app-header,
  .summary,
  .workspace,
  .season-strip,
  .admin-grid,
  .create-user,
  .product-form {
    grid-template-columns: 1fr;
  }

  .app-header,
  .summary,
  .season-strip,
  .workspace {
    padding-left: 16px;
    padding-right: 16px;
  }

  .season-strip {
    margin-left: 16px;
    margin-right: 16px;
  }

  .brand {
    align-items: flex-start;
    display: grid;
    gap: 12px;
  }

  .products-panel {
    max-height: none;
    position: static;
  }

  .preview-panel {
    grid-column: 1;
  }

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

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

  .plan-row label:first-child,
  .plan-row label:nth-child(2),
  .plan-row label:nth-child(3) {
    grid-column: 1 / -1;
  }
}
