:root {
  color-scheme: light;
  --ink: #1b1b1b;
  --muted: #68625c;
  --line: #ddd8d2;
  --paper: #fffdfa;
  --surface: #f6f2ec;
  --accent: #a84e2e;
  --accent-dark: #7f3921;
  --card-min: 220px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden],
body.auth-locked #app,
body.auth-unlocked #login {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--surface);
}

.login-panel {
  width: min(440px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 18px 70px rgb(28 22 17 / 10%);
}

.login-logo {
  width: 210px;
  max-width: 100%;
  display: block;
  margin-bottom: 28px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.login-form {
  margin-top: 28px;
}

.login-form label,
.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.password-row input,
.toolbar input,
.toolbar select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
}

.password-row button,
.actions button {
  border-radius: 6px;
  padding: 11px 16px;
  font-weight: 750;
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 253 250 / 94%);
  backdrop-filter: blur(10px);
}

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

.brand img {
  width: 178px;
  max-width: 38vw;
}

.brand h1 {
  font-size: clamp(24px, 3vw, 38px);
}

.selected-meter {
  min-width: 122px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: white;
}

.selected-meter strong {
  display: block;
  font-size: 28px;
}

.selected-meter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.disclaimer {
  margin: 20px 28px 0;
  padding: 14px 16px;
  border: 1px solid #ead9aa;
  border-radius: 8px;
  background: #fff8df;
  color: #604d21;
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 0.7fr) minmax(150px, 0.5fr);
  gap: 14px;
  align-items: end;
  margin: 18px 28px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.thumb-field input {
  padding-inline: 0;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.request-panel {
  position: fixed;
  right: 28px;
  bottom: 18px;
  left: 28px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1.3fr);
  gap: 18px;
  align-items: start;
  max-height: min(78vh, 560px);
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 -12px 44px rgb(28 22 17 / 10%);
  overflow: auto;
}

.request-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5d534b;
  color: white;
  font-size: 26px;
  line-height: 1;
}

.request-close:hover {
  background: #413a35;
}

.request-panel.has-selection {
  border-color: rgb(168 78 46 / 42%);
  box-shadow: 0 -14px 46px rgb(168 78 46 / 16%);
}

.request-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.request-toggle-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.request-summary:hover {
  background: rgb(168 78 46 / 6%);
}

.request-summary strong {
  display: block;
  font-size: 24px;
}

.request-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.request-summary-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  font-weight: 800;
}

.request-help {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.request-list {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.request-list p {
  margin: 0 0 8px;
  font-weight: 800;
}

.request-list ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  list-style: none;
}

.request-list li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.request-list img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}

.request-list span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.request-list .request-more {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 800;
}

.empty-request {
  color: var(--muted);
}

.request-panel.is-collapsed {
  grid-template-columns: 1fr;
  max-height: none;
  overflow: visible;
}

.request-panel.is-collapsed .request-close {
  display: none;
}

.request-panel.is-collapsed .request-copy,
.request-panel.is-collapsed .request-form {
  display: none;
}

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

.request-form input,
.request-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  resize: vertical;
}

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

.request-actions button {
  border-radius: 6px;
  padding: 11px 16px;
  font-weight: 750;
}

.request-result {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-weight: 800;
}

.actions button:nth-child(2) {
  background: #5d534b;
}

.actions button:nth-child(2):hover {
  background: #413a35;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 28px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
  gap: 14px;
  padding: 18px 28px 160px;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.product-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(168 78 46 / 13%);
}

.image-button {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  padding: 0;
  background: white;
}

.image-button:hover {
  background: white;
}

.image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-info {
  display: grid;
  gap: 7px;
  padding: 11px;
  border-top: 1px solid var(--line);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.filename {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.3;
}

dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  background: white;
}

dialog::backdrop {
  background: rgb(24 18 14 / 58%);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
}

#preview-image {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  display: block;
  background: white;
}

#preview-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .site-header,
  .brand {
    align-items: flex-start;
  }

  .site-header {
    position: static;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .request-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header,
  .status-row {
    flex-direction: column;
  }

  .site-header,
  .disclaimer,
  .toolbar,
  .status-row,
  .product-grid {
    margin-left: 14px;
    margin-right: 14px;
    padding-left: 0;
    padding-right: 0;
  }

  .site-header {
    margin: 0;
    padding: 16px 14px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .request-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .request-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .request-summary strong {
    font-size: 20px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr));
    padding-bottom: 140px;
  }
}
