:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #201c2b;
  background: #f6f4fb;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  padding-bottom: 92px;
  background:
    radial-gradient(circle at top right, rgba(109, 74, 255, 0.12), transparent 30rem),
    #f6f4fb;
}

body.auth-checking,
body.auth-required {
  padding-bottom: 0;
}

body.auth-checking .topbar,
body.auth-checking main,
body.auth-checking .bottom-nav,
body.auth-required .topbar,
body.auth-required main,
body.auth-required .bottom-nav {
  display: none;
}

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

.login-card {
  width: min(430px, 100%);
  padding: clamp(24px, 6vw, 38px);
  border: 1px solid rgba(94, 76, 126, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(44, 30, 74, 0.14);
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 8vw, 3rem);
}

.login-card p {
  color: #756e7e;
}

.login-remember {
  justify-content: flex-start;
  margin: 14px 0 4px;
  padding: 0;
  background: transparent;
}

.login-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  color: #8b1e32;
  background: #ffe6ec;
  font-size: 0.9rem;
  font-weight: 700;
}

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

.logout-button {
  white-space: nowrap;
}

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

button {
  cursor: pointer;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset:disabled {
  opacity: 0.52;
}

.topbar,
main {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 14px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 5vw, 2.25rem);
  line-height: 1.12;
}

.eyebrow {
  margin-bottom: 5px;
  color: #776f84;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.connection {
  padding: 8px 11px;
  border: 1px solid #ded9eb;
  border-radius: 999px;
  color: #615a6d;
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  justify-content: space-between;
  padding: clamp(24px, 6vw, 54px);
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, #241946, #6d4aff 68%, #947fff);
  box-shadow: 0 22px 60px rgba(74, 49, 167, 0.2);
}

.hero .eyebrow,
.hero-copy {
  color: rgba(255, 255, 255, 0.72);
}

.hero-copy {
  margin-bottom: 0;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding: clamp(22px, 5vw, 38px);
  border: 1px solid rgba(94, 76, 126, 0.11);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(44, 30, 74, 0.06);
}

.page-intro h2 {
  margin-bottom: 7px;
}

.page-intro p:last-child {
  margin-bottom: 0;
  color: #756e7e;
}

.primary,
.secondary {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 800;
}

.primary {
  border: 0;
  color: #32215e;
  background: #dfff78;
  box-shadow: 0 8px 24px rgba(30, 20, 50, 0.18);
}

.secondary {
  border: 1px solid #cec4ff;
  color: #5436d6;
  background: #f1edff;
}

.full-width {
  width: 100%;
  margin: 6px 0 18px;
}

.secondary:disabled {
  cursor: progress;
  opacity: 0.72;
}

.ai-result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 10px 12px;
  border-radius: 13px;
  background: #f6f3ff;
}

.ai-result-actions small {
  color: #766f82;
  font-size: 0.78rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.status-stats {
  grid-template-columns: repeat(4, 1fr);
}

.compact-stats {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.stat-card,
.panel {
  border: 1px solid rgba(94, 76, 126, 0.11);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 36px rgba(44, 30, 74, 0.06);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  border-radius: 18px;
}

.stat-card span {
  color: #776f84;
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-card strong {
  font-size: 1.8rem;
}

.stat-card.accent {
  background: #edffd2;
}

.status-draft {
  background: rgba(245, 196, 55, 0.17);
}

.status-deferred {
  background: rgba(139, 126, 196, 0.16);
}

.status-listed {
  background: rgba(115, 204, 116, 0.17);
}

.status-shipping {
  background: rgba(86, 169, 232, 0.17);
}

.status-sold {
  background: rgba(45, 157, 91, 0.25);
}

.panel {
  margin-bottom: 18px;
  padding: clamp(20px, 5vw, 34px);
  border-radius: 24px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

.section-count {
  color: #776f84;
  font-size: 0.8rem;
  white-space: nowrap;
}

.supply-admin {
  padding: 0;
  overflow: hidden;
}

.supply-admin-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  cursor: pointer;
  list-style: none;
}

.supply-admin-summary::-webkit-details-marker {
  display: none;
}

.supply-admin-summary::after {
  content: "⌄";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #6d4aff;
  background: #f1edff;
  font-weight: 900;
  transition: transform 160ms ease;
}

.supply-admin[open] .supply-admin-summary::after {
  transform: rotate(180deg);
}

.supply-admin-summary > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.supply-admin-summary strong {
  font-size: 1rem;
}

.supply-admin-summary .section-count {
  margin-left: auto;
}

.supply-admin-content {
  padding: 0 20px 20px;
}

.supply-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.supply-picker > span {
  font-size: 0.82rem;
  font-weight: 800;
}

.supply-summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(280px, 2fr);
  gap: 12px;
  margin-bottom: 18px;
}

.supply-summary > div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background: #f5f2ff;
}

.supply-summary span {
  color: #7a7285;
  font-size: 0.76rem;
  font-weight: 750;
}

.supply-summary strong {
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-summary .barcode-display {
  color: #5436d6;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.supply-print .text-button {
  min-height: 28px;
  padding: 0;
  text-align: left;
}

.supply-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.danger-text {
  color: #b43b4b;
}

.supply-management {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: -6px 0 18px;
  color: #81798b;
  font-size: 0.78rem;
}

.danger-button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #e9b9c0;
  border-radius: 12px;
  color: #a62e40;
  background: #fff4f5;
  font-weight: 800;
}

.danger-button.subtle {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  font-size: 0.72rem;
}

#printArea {
  display: none;
}

.labels-dialog {
  width: min(620px, calc(100% - 28px));
  padding: 24px;
  border: 0;
  border-radius: 22px;
  color: #241f2d;
  background: #fff;
  box-shadow: 0 24px 70px rgba(36, 25, 70, 0.28);
}

.labels-dialog::backdrop {
  background: rgba(27, 21, 38, 0.55);
  backdrop-filter: blur(3px);
}

.labels-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.labels-dialog-heading h2 {
  margin: 3px 0 0;
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #5f5868;
  background: #f1eef5;
  font-size: 1.5rem;
  line-height: 1;
}

.labels-summary {
  margin: 14px 0;
  color: #625a6c;
  font-weight: 750;
}

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

.label-range .field {
  margin: 0;
}

.label-range .secondary {
  min-height: 48px;
}

.label-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.label-preview .print-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 58 / 40;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #d9d5df;
  border-radius: 8px;
  color: #000;
  background: #fff;
}

.label-preview svg {
  width: 100%;
  height: auto;
  max-height: 70%;
}

.label-preview .print-code {
  margin-top: 5px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.62rem, 1.8vw, 0.95rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.labels-help {
  margin: 16px 0;
  color: #766f7f;
  font-size: 0.86rem;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.supply-setup {
  border-top: 1px solid #ebe6f2;
  padding-top: 16px;
}

.supply-setup summary {
  color: #5f477a;
  font-weight: 800;
  cursor: pointer;
}

.supply-setup form {
  padding-top: 18px;
}

.supply-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.supply-grid .wide {
  grid-column: span 2;
}

.new-supplier {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 560px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 14px;
  background: #f8f6fb;
}

.new-supplier .field {
  flex: 1;
  margin: 0;
}

.form-guard {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #e7d59b;
  border-radius: 14px;
  color: #674f12;
  background: #fff8dc;
  font-size: 0.86rem;
  font-weight: 750;
}

.text-button {
  padding: 6px;
  border: 0;
  color: #6d4aff;
  background: transparent;
  font-weight: 750;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.single-field-grid {
  grid-template-columns: minmax(0, 1fr);
}

.field-grid .wide {
  grid-column: auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field > span {
  font-size: 0.88rem;
  font-weight: 800;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label-row small {
  font-weight: 700;
}

.field-label-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.current-supply-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #e8e2ff;
  border-radius: 8px;
  background: #fbfaff;
}

.current-supply-banner span {
  display: block;
  margin-bottom: 3px;
  color: #6f6685;
  font-size: 0.78rem;
  font-weight: 700;
}

.current-supply-banner strong {
  display: block;
  overflow: hidden;
  color: #201a35;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-field-button {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #ddd6f8;
  border-radius: 10px;
  color: #5436d6;
  background: #fbfaff;
}

.copy-field-button::before,
.copy-field-button::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: #fbfaff;
}

.copy-field-button::before {
  top: 8px;
  left: 8px;
}

.copy-field-button::after {
  top: 6px;
  left: 11px;
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dcd6e8;
  border-radius: 13px;
  outline: none;
  color: #241f2d;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input,
select {
  min-height: 48px;
  padding: 0 14px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #716a7b 50%),
    linear-gradient(135deg, #716a7b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

textarea {
  padding: 13px 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8067f5;
  box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.1);
}

input[readonly] {
  color: #716a7b;
  background: #f4f1f7;
}

.field small,
.photo-picker small {
  color: #847c8e;
}

.photo-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 164px;
  margin: 4px 0 16px;
  padding: 22px;
  border: 2px dashed #cfc6e7;
  border-radius: 18px;
  text-align: center;
  background: #faf8ff;
  cursor: pointer;
}

.photo-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.camera-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 50%;
  color: #fff;
  background: #6d4aff;
  font-size: 1.6rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.photo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.photo-toolbar > strong {
  color: #7a7285;
  font-size: 0.8rem;
}

.gallery-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #d7cff6;
  border-radius: 11px;
  color: #5436d6;
  background: #f6f3ff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.gallery-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ai-materials {
  margin: -4px 0 14px;
  color: #7a7285;
  font-size: 0.78rem;
}

.ai-materials summary {
  width: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #6d4aff;
  background: #f4f0ff;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.ai-materials summary::-webkit-details-marker {
  display: none;
}

.ai-materials-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ai-materials-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #ddd6f8;
  border-radius: 999px;
  color: #5436d6;
  background: #fbfaff;
  font-weight: 850;
  cursor: pointer;
}

.ai-materials-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ai-material-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-material-tile {
  position: relative;
  width: 42px;
  height: 42px;
}

.ai-material-tile img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  background: #ece8f2;
  cursor: zoom-in;
}

.ai-material-tile button {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(35, 28, 45, 0.78);
  font-size: 0.8rem;
  font-weight: 900;
}

.photo-card {
  position: relative;
}

.photo-card img {
  cursor: zoom-in;
}

.photo-card img[draggable="true"] {
  cursor: grab;
}

.photo-card-actions {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  justify-content: center;
  gap: 3px;
}

.photo-card-actions button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(35, 28, 45, 0.76);
  font-size: 0.85rem;
  font-weight: 900;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 18px;
  font-size: 0.9rem;
  font-weight: 750;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  margin: 0;
}

.photo-grid img,
.item-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  background: #ece8f2;
}

.voice-field {
  position: relative;
}

.voice-field textarea {
  padding-right: 88px;
}

.voice-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: #5436d6;
  background: #eee9ff;
  font-size: 0.78rem;
  font-weight: 800;
}

.voice-field textarea.recording {
  border-color: #6d4aff;
  box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.12);
}

.voice-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #5436d6;
  font-size: 0.8rem;
  font-weight: 800;
}

.recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff4f7a;
  box-shadow: 0 0 0 0 rgba(255, 79, 122, 0.42);
  animation: recordingPulse 1.2s infinite;
}

@keyframes recordingPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(255, 79, 122, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 79, 122, 0);
  }
}

.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.form-actions p {
  margin: 0;
  color: #7a7285;
  font-size: 0.82rem;
}

.empty-state {
  padding: 28px;
  border-radius: 16px;
  text-align: center;
  color: #7b7485;
  background: #f8f6fb;
}

.empty-state p {
  margin: 5px 0 0;
}

.integration-note {
  margin: -4px 0 16px;
  padding: 13px 15px;
  border-radius: 13px;
  color: #665d72;
  background: #f5f2fa;
  font-size: 0.84rem;
}

.items-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.search-field,
#exportSearch {
  grid-column: span 2;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.item-row {
  display: grid;
  grid-template-columns: 34px 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ece8f2;
  border-radius: 15px;
}

.item-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #5436d6;
  background: #f0ecff;
  font-size: 0.78rem;
  font-weight: 900;
}

.item-row h3,
.item-row p {
  margin: 0;
}

.item-row h3 {
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.item-row p {
  color: #81798b;
  font-size: 0.8rem;
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #514b58;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-chip.status-draft {
  background: rgba(245, 196, 55, 0.22);
}

.status-chip.status-deferred {
  background: rgba(139, 126, 196, 0.22);
}

.status-chip.status-listed {
  background: rgba(115, 204, 116, 0.22);
}

.status-chip.status-shipping {
  background: rgba(86, 169, 232, 0.22);
}

.status-chip.status-sold {
  background: rgba(45, 157, 91, 0.3);
}

.status-chip.relist-chip {
  margin-left: 6px;
  color: #7a5220;
  background: rgba(220, 150, 54, 0.17);
}

.item-price {
  font-weight: 850;
  white-space: nowrap;
}

.base-group-row {
  border: 1px solid #ece8f2;
  border-radius: 15px;
  background: #fff;
}

.base-group-row summary {
  display: grid;
  grid-template-columns: 34px 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.base-group-row summary::-webkit-details-marker {
  display: none;
}

.base-group-title {
  min-width: 0;
}

.base-group-title h3,
.base-group-title p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-group-actions {
  display: grid;
  grid-template-columns: 105px auto;
  align-items: center;
  gap: 8px;
}

.base-group-actions small {
  color: #5436d6;
  font-size: 0.78rem;
  font-weight: 850;
}

.base-group-row[open] .base-group-actions small {
  color: #81798b;
}

.base-group-row[open] .base-group-actions small::before {
  content: "Скрыть";
  font-size: 0;
}

.base-group-row[open] .base-group-actions small {
  font-size: 0;
}

.base-group-row[open] .base-group-actions small::before {
  font-size: 0.78rem;
}

.base-group-units {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.base-item-child {
  border-style: dashed;
  background: #fbfaff;
}

.item-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 105px 145px auto;
  align-items: center;
  gap: 8px;
}

.quick-price,
.quick-status {
  min-height: 38px;
  font-size: 0.78rem;
}

.quick-price {
  padding: 0 9px;
  text-align: right;
}

.quick-status {
  padding: 0 30px 0 10px;
  border-color: transparent;
  font-weight: 750;
}

.quick-status.status-draft {
  background-color: rgba(245, 196, 55, 0.18);
}

.quick-status.status-deferred {
  background-color: rgba(139, 126, 196, 0.18);
}

.quick-status.status-listed {
  background-color: rgba(115, 204, 116, 0.18);
}

.quick-status.status-shipping {
  background-color: rgba(86, 169, 232, 0.18);
}

.quick-status.status-sold {
  background-color: rgba(45, 157, 91, 0.27);
}

.compact-items {
  gap: 6px;
}

.supply-item-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #eeeaf2;
}

.supply-item-row > span:not(.status-chip) {
  overflow: hidden;
  color: #6f6878;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-item-row .status-chip {
  margin-top: 0;
}

.supply-group-row {
  border-bottom: 1px solid #eeeaf2;
  background: #fff;
}

.supply-group-row summary {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(170px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.supply-group-row summary::-webkit-details-marker {
  display: none;
}

.supply-group-row summary::after {
  content: "Раскрыть";
  justify-self: end;
  color: #5436d6;
  font-size: 0.78rem;
  font-weight: 850;
}

.supply-group-row[open] summary::after {
  content: "Скрыть";
}

.supply-group-code {
  color: #201a35;
  font-weight: 900;
}

.supply-group-title {
  min-width: 0;
}

.supply-group-title strong,
.supply-group-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-group-title small,
.supply-group-statuses {
  color: #6f6878;
  font-size: 0.78rem;
  font-weight: 750;
}

.supply-group-tools {
  padding: 0 12px 10px;
}

.supply-group-tools .field {
  margin: 0;
}

.supply-group-units {
  border-top: 1px solid #f1edf5;
}

.supply-item-child {
  padding-left: 24px;
  background: #fbfaff;
}

.export-items {
  gap: 8px;
}

.export-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #ece8f2;
  border-radius: 15px;
  cursor: pointer;
}

.export-row > input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: #6d4aff;
}

.export-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.export-row > div strong,
.export-row > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-row > div span {
  color: #81798b;
  font-size: 0.78rem;
}

.supply-analytics {
  display: grid;
  gap: 10px;
}

.analytics-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #ece8f2;
  border-radius: 16px;
}

.analytics-card h3,
.analytics-card p {
  margin: 0;
}

.analytics-card h3 {
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.analytics-card p {
  color: #81798b;
  font-size: 0.78rem;
}

.analytics-card .supply-comment {
  margin-top: 7px;
  color: #4f465e;
  font-weight: 750;
}

.analytics-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, auto));
  gap: 18px;
}

.monthly-sales {
  display: flex;
  gap: 10px;
  padding: 2px 0 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-color: #cfc6e7 transparent;
}

.month-card {
  display: flex;
  flex: 0 0 min(240px, 78vw);
  flex-direction: column;
  gap: 5px;
  padding: 16px;
  border-radius: 15px;
  background: #f6f3fb;
  scroll-snap-align: start;
}

.month-card > span {
  font-size: 1.2rem;
  font-weight: 850;
}

.month-card small {
  color: #81798b;
}

.item-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 24px;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  color: #241f2d;
  background: #fff;
  box-shadow: 0 24px 70px rgba(36, 25, 70, 0.28);
}

.item-dialog::backdrop {
  background: rgba(27, 21, 38, 0.55);
  backdrop-filter: blur(3px);
}

.item-dialog form {
  margin-top: 18px;
}

.dialog-photo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-photo-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.compact-button {
  min-height: 40px;
  padding: 9px 13px;
}

.dialog-photo-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.photo-viewer {
  width: min(960px, calc(100% - 24px));
  max-width: 960px;
  max-height: calc(100vh - 24px);
  padding: 48px 16px 52px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: rgba(18, 14, 25, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.photo-viewer::backdrop {
  background: rgba(14, 10, 20, 0.75);
  backdrop-filter: blur(4px);
}

.photo-viewer img {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 760px);
  margin: 0 auto;
  border-radius: 16px;
  object-fit: contain;
}

.photo-viewer-close {
  position: absolute;
  top: 10px;
  right: 12px;
  color: #fff;
}

.photo-viewer-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-size: 2.4rem;
  line-height: 1;
  transform: translateY(-50%);
}

.photo-viewer-nav.previous {
  left: 14px;
}

.photo-viewer-nav.next {
  right: 14px;
}

.photo-viewer-nav:disabled {
  opacity: 0.25;
}

.photo-viewer p {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
}

.split-actions {
  justify-content: space-between;
}

.analytics-figures > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.analytics-figures span {
  color: #81798b;
  font-size: 0.68rem;
}

.analytics-figures strong {
  white-space: nowrap;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(620px, calc(100% - 22px));
  padding: 7px;
  border: 1px solid rgba(91, 75, 121, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 48px rgba(38, 26, 62, 0.2);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 56px;
  padding: 5px 6px;
  border: 0;
  border-radius: 14px;
  color: #7b7485;
  background: transparent;
  flex-direction: column;
  gap: 3px;
  font-size: 0.69rem;
  font-weight: 800;
}

.nav-button.active {
  color: #5436d6;
  background: #f0ecff;
}

.nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.toast {
  position: fixed;
  z-index: 80;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  left: 14px;
  width: min(560px, calc(100% - 28px));
  margin-inline: auto;
  padding: 13px 16px;
  border-radius: 13px;
  color: #fff;
  background: #241946;
  box-shadow: 0 14px 36px rgba(36, 25, 70, 0.26);
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 680px) {
  .topbar,
  main {
    width: min(100% - 22px, 1080px);
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .page-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .page-intro .primary {
    width: 100%;
  }

  .hero .primary {
    width: 100%;
  }

  .stats {
    gap: 8px;
  }

  .status-stats {
    grid-template-columns: 1fr 1fr;
  }

  .compact-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    padding: 14px 11px;
  }

  .stat-card span {
    font-size: 0.72rem;
  }

  .stat-card strong {
    font-size: 1.45rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .current-supply-banner {
    grid-template-columns: 1fr;
  }

  .current-supply-banner .compact-button {
    width: 100%;
  }

  .supply-summary {
    grid-template-columns: 1fr;
  }

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

  .supply-grid .wide {
    grid-column: auto;
  }

  .new-supplier {
    align-items: stretch;
    flex-direction: column;
  }

  .supply-management {
    align-items: stretch;
    flex-direction: column;
  }

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

  .search-field,
  #exportSearch {
    grid-column: auto;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .labels-dialog {
    padding: 19px;
  }

  .label-preview {
    grid-template-columns: 1fr 1fr;
  }

  .label-preview .print-label:last-child {
    display: none;
  }

  .label-range {
    grid-template-columns: 1fr 1fr;
  }

  .label-range .secondary {
    grid-column: 1 / -1;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions .primary {
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .primary {
    width: 100%;
  }

  .form-actions .danger-button {
    width: 100%;
  }

  .item-row {
    grid-template-columns: 34px 54px minmax(0, 1fr);
  }

  .base-group-row summary {
    grid-template-columns: 34px 54px minmax(0, 1fr);
  }

  .base-group-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .base-group-units .item-row {
    grid-template-columns: 34px 54px minmax(0, 1fr);
  }

  .item-actions {
    grid-column: 3;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .quick-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1.25fr auto;
    width: 100%;
  }

  .supply-group-row summary {
    grid-template-columns: 1fr;
  }

  .supply-group-row summary::after {
    justify-self: start;
  }

  .supply-item-row {
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .supply-item-row > span:nth-of-type(2) {
    display: none;
  }

  .supply-item-row .status-chip {
    grid-column: 2;
  }

  .supply-item-row .text-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .export-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .export-row > .status-chip {
    grid-column: 2;
    margin-top: 0;
  }

  .export-row > .text-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .analytics-card {
    grid-template-columns: 1fr;
  }

  .analytics-figures {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .analytics-figures strong {
    font-size: 0.86rem;
  }

  .item-dialog {
    padding: 19px;
  }

  .dialog-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dialog-photo-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .dialog-photo-actions-row {
    width: 100%;
    justify-content: space-between;
  }

  .split-actions {
    flex-direction: column-reverse;
  }
}

@media print {
  @page {
    size: 58mm 40mm;
    margin: 0;
  }

  body {
    margin: 0;
    background: #fff;
  }

  body > :not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }

  .print-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58mm;
    height: 40mm;
    overflow: hidden;
    color: #000;
    background: #fff;
    break-after: page;
    page-break-after: always;
  }

  .print-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-label svg {
    width: 52mm;
    height: 26mm;
    shape-rendering: crispEdges;
  }

  .print-code {
    margin-top: 1.5mm;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 6mm;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.25mm;
  }
}
