:root {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: #18332f;
  background: #f2f4f1;
  font-size: 16px;
  --ink: #18332f;
  --muted: #526861;
  --green: #165d48;
  --green-dark: #104534;
  --line: #c6d1ca;
  --amber: #805018;
  --wa: #1f7a44;
  --wa-dark: #165c33;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  min-height: 44px;
  padding: .65rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
button:hover, .button:hover { background: var(--green-dark); }
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary { color: var(--ink); background: #fff; border-color: #7b9388; }
.secondary:hover { background: #e7eee8; }
.danger { background: #9b3030; border-color: #9b3030; color: #fff; }
.danger:hover { background: #7c2323; }
.button.whatsapp { background: var(--wa); border-color: var(--wa); color: #fff; }
.button.whatsapp:hover { background: var(--wa-dark); }
a, button, input, textarea, select { outline-offset: 4px; scroll-margin: 5rem; }
:focus-visible { outline: 3px solid #b16b13; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: .7rem;
  border: 1px solid #7b9388;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 100px; }
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .4rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -.04em; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 0 0 .6rem; }
p { line-height: 1.65; margin: .5rem 0 1rem; }
p, small, h1, h2 { overflow-wrap: anywhere; }
small, .muted { color: var(--muted); }
small { line-height: 1.5; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
select[multiple] { min-height: 150px; }
summary { cursor: pointer; min-height: 44px; display: list-item; padding: .6rem 0; }

.eyebrow {
  font: 700 .76rem Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header & Navigation */
.skip { position: absolute; left: 1rem; top: -6rem; background: #fff; padding: 1rem; z-index: 100; }
.skip:focus { top: 1rem; }
.demo-banner {
  padding: .55rem 1rem;
  text-align: center;
  background: #f4e6bf;
  color: #664310;
  font-size: .82rem;
  font-weight: 600;
}
header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 1rem clamp(1rem, 4vw, 3.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; gap: .85rem; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark {
  background: var(--ink);
  color: #fff;
  padding: .55rem .7rem;
  border-radius: 5px;
  font: 700 1.05rem Consolas, monospace;
  letter-spacing: .04em;
}
.brand strong, .brand small { display: block; }
.userbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
nav {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: .6rem clamp(1rem, 4vw, 3.5rem);
  background: #fff;
}
nav a {
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
nav a:hover { background: #edf2ed; }
nav a.selected { background: #e2ede7; color: var(--green); border-color: #b0c4b7; }
main { max-width: 1400px; padding: 1.8rem clamp(1rem, 4vw, 3.5rem) 4rem; margin: auto; }
.site-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.4rem clamp(1rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .82rem;
}

/* Headings, Panels & Layouts */
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.heading p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.panel { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 1.4rem; margin-bottom: 1rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin: 1.2rem 0 1.5rem;
}
.stat { padding: 1rem 1.2rem; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; margin-top: .25rem; }
.stat span { font-size: .82rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.full { grid-column: 1 / -1; }
.field { min-width: 0; }
.stack { display: grid; gap: 1rem; }
.note {
  padding: .85rem 1rem;
  background: #f8efd9;
  border-left: 3px solid #a5792d;
  line-height: 1.6;
  font-size: .88rem;
}
.note.ok-note { background: #e5f1e9; border-left-color: var(--green); }
.error {
  color: #9b2323;
  background: #fff1ef;
  padding: .8rem 1rem;
  border: 1px solid #c88d85;
  border-radius: 5px;
  margin-bottom: 1rem;
}
.hidden { display: none !important; }
.code { font-family: Consolas, monospace; }
.preline { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 3rem 1rem; text-align: center; }
.empty p { max-width: 480px; margin: .6rem auto 1.4rem; }
.compact { font-size: .82rem; padding: .42rem .7rem; min-height: 36px; }
.wide { width: 100%; }
.login-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
.back-link { display: inline-flex; min-height: 44px; align-items: center; font-size: .88rem; font-weight: 600; }
.linklike { border-color: transparent; background: transparent; color: var(--green); padding: .4rem .6rem; }
.linklike:hover { background: #e7eee8; }
.check { display: flex; align-items: center; gap: .7rem; cursor: pointer; }
.check input { width: 20px; min-height: 20px; flex: none; margin: 0; }

/* Password Show/Hide & Strength Meter */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 3.1rem; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 36px;
  height: 36px;
  width: 38px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
}
.pw-toggle:hover { background: #e7eee8; color: var(--ink); }
.pw-toggle svg { width: 20px; height: 20px; display: block; }
.pw-meter { margin-top: .45rem; }
.pw-meter-track { height: 6px; background: #dce3dd; border-radius: 99px; overflow: hidden; }
.pw-meter-bar { height: 100%; width: 0%; transition: width .2s ease, background-color .2s ease; }
.pw-meter-bar.weak { width: 33%; background: #b8322a; }
.pw-meter-bar.fair { width: 66%; background: #b7791f; }
.pw-meter-bar.strong { width: 100%; background: #165d48; }
.pw-meter-text { display: block; margin-top: .25rem; font-size: .78rem; color: var(--muted); }

/* Search & Filters */
.search-panel {
  padding: 1.3rem;
  background: #e6ede5;
  border: 1px solid #b9c8bd;
  border-radius: 8px;
  margin-bottom: 1.3rem;
}
.search-panel > input { font-size: 1.05rem; background: #fff; min-height: 50px; }
.filter-row { display: grid; grid-template-columns: 1fr; gap: .8rem; margin-top: 1rem; }

/* Admin Toolbar & Bulk Status Bar */
.result-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  font-size: .86rem;
  color: var(--muted);
}
.view-toggle { display: inline-flex; border: 1px solid #7b9388; border-radius: 6px; overflow: hidden; background: #fff; }
.view-toggle button {
  min-height: 36px;
  padding: .35rem .8rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
}
.view-toggle button.active { background: var(--green); color: #fff; }

.bulk-bar {
  position: sticky;
  top: .5rem;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  margin: 0 0 1rem;
  background: #18332f;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(24, 51, 47, .18);
}
.bulk-bar strong { font-size: .92rem; }
.bulk-bar .secondary { background: #fff; color: var(--ink); border-color: #fff; }
.bulk-bar .secondary:hover { background: #e7eee8; }
.bulk-bar .bulk-ghost { background: transparent; color: #dce8e2; border-color: #5b7870; }
.bulk-bar .bulk-ghost:hover { background: #264843; color: #fff; }

/* Product Grid & Cards */
.product-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.product-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.product-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(22, 93, 72, .22);
}
.card-select {
  position: absolute;
  top: .6rem;
  left: .6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #7b9388;
  border-radius: 6px;
  cursor: pointer;
}
.card-select input { width: 18px; height: 18px; min-height: 18px; margin: 0; cursor: pointer; }
.product-photo { display: block; background: #e9eeea; border-bottom: 1px solid var(--line); }
.product-photo .photo-card {
  width: 100%;
  height: 210px;
  object-fit: contain;
  display: block;
  background: #f2f5f0;
}
.no-photo.photo-card, .no-photo.photo-large {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(135deg, #eef1ed, #eef1ed 14px, #e8ede7 14px, #e8ede7 15px);
  color: #52685c;
  text-align: center;
  font-size: .88rem;
  line-height: 1.5;
}
.product-copy { padding: 1.1rem; }
.product-copy h2 { font-size: 1.12rem; line-height: 1.38; margin: .65rem 0 .25rem; }
.product-copy h2 a { color: var(--ink); text-decoration: none; }
.product-copy h2 a:hover { text-decoration: underline; }
.product-copy p { margin: .2rem 0 .8rem; font-size: .9rem; }
.product-top { display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.product-code {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  border-top: 1px solid #dce3dd;
  padding-top: .75rem;
  font: .8rem Consolas, monospace;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }

/* Tables & Pills */
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
th {
  font-weight: 600;
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #eaf0ea;
  padding: .8rem .9rem;
  white-space: nowrap;
}
td { padding: .85rem .9rem; border-top: 1px solid #dce3dd; vertical-align: middle; }
tr.selected td { background: #eef6f1; }
td strong { display: block; }
td small { display: block; margin-top: .25rem; }
.col-check { width: 42px; text-align: center; }
.col-check input { width: 18px; height: 18px; min-height: 18px; cursor: pointer; }
.item-cell { display: flex; gap: .75rem; align-items: center; min-width: 220px; }
.thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f5f7f4;
  flex: none;
}
.no-photo { display: flex; align-items: center; justify-content: center; color: #667a70; font-size: .68rem; text-align: center; }
.pill {
  display: inline-block;
  padding: .22rem .52rem;
  background: #f9e9c8;
  color: #70430b;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid #c7a269;
  border-radius: 4px;
  white-space: nowrap;
}
.pill.ok { background: #e5f1e9; color: #245b3b; border-color: #91b39e; }
.pill.muted-pill { background: #ecefed; color: #4d5f59; border-color: #bcc7c1; }

/* Detail Page & Zoom Gallery */
.photo-large {
  width: 100%;
  height: clamp(220px, 35vw, 420px);
  object-fit: contain;
  background: #f2f5f0;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: block;
}
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 1.8rem; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.2rem 0; }
.detail-meta div { border-bottom: 1px solid var(--line); padding-bottom: .8rem; overflow-wrap: anywhere; }
.detail-meta small { display: block; margin-bottom: .35rem; }
.detail-heading { margin-top: .7rem; }
.image-button { background: none; border: 0; padding: 0; display: block; width: 100%; border-radius: 6px; min-height: 0; }
.image-button:hover { background: #e3ebe2; }
.gallery { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
.gallery .image-button { width: auto; border: 1px solid var(--line); }
.gallery .thumb { height: 70px; width: 70px; }
.zoom-stage { text-align: center; }
.zoom-photo { width: 100%; height: auto; max-height: 66dvh; object-fit: contain; border-radius: 6px; background: #f2f5f0; }
.zoom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.zoom-caption { margin: .6rem 0 0; font-size: .9rem; color: var(--muted); }
.wa-box { margin-top: 1.2rem; display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

/* Editor & Versions */
.editor-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.editor-photo {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: .8rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}
.editor-photo .thumb { width: 65px; height: 65px; }
.editor-photo small { display: block; font-size: .72rem; }
.editor-photo .actions { margin-top: .5rem; }
.file-input { display: block; margin-top: .6rem; font-size: .82rem; }
.file-input::file-selector-button {
  font: inherit;
  padding: .4rem .6rem;
  border: 1px solid #7b9388;
  border-radius: 4px;
  background: #edf2ec;
  cursor: pointer;
}
.version-row { padding: 1rem; border: 1px solid var(--line); border-radius: 6px; }
.version-row small { display: block; margin-top: .35rem; }
.version-row pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
.version-row button { margin-top: .7rem; }

/* Import, Labels, Settings, Auth, Dialog */
.steps { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.3rem 0; }
.steps span { padding: .55rem .85rem; border: 1px solid #b7c7bc; border-radius: 4px; font-size: .8rem; background: #e6ede5; }
.import-confirm { margin: 1.2rem 0; line-height: 1.5; }
.usage-number { font: 700 2rem Consolas, monospace; }
.preview-photo-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.preview-photo-grid figure { margin: 0; }
.preview-photo-grid figcaption { font-size: .8rem; overflow-wrap: anywhere; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.part-label {
  border: 1px dashed #809588;
  padding: .8rem;
  text-align: center;
  background: #fff;
  break-inside: avoid;
  overflow-wrap: anywhere;
}
.part-label img { width: 150px; height: 150px; display: block; margin: auto; }
.part-label strong { display: block; font-size: .9rem; }
.part-label .code { font: 700 1rem Consolas, monospace; }
.part-label .pill { margin-top: .5rem; }
.label-controls { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-top: .6rem; }
.label-controls label { margin: 0; }
.label-controls input { width: 72px; }
.qr-preview-box { max-width: 240px; margin: 0 auto; }
.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  padding: .8rem 0;
  border-top: 1px solid var(--line);
}
.admin-item:first-of-type { border-top: 0; }
.auth { max-width: 510px; margin: 3rem auto; padding: 0 1rem; }
.auth .panel { padding: 1.8rem; }
.auth form { display: grid; gap: 1rem; }
.setup-help { max-width: 720px; margin: 3rem auto; padding: 0 1rem; }
.photo-error { font-size: .8rem; color: #8e2b24; }
dialog {
  border: 1px solid #9aac9f;
  border-radius: 10px;
  width: min(780px, calc(100% - 2rem));
  max-height: 90dvh;
  padding: 0;
  color: var(--ink);
}
dialog::backdrop { background: rgba(20, 47, 40, .45); }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.dialog-body { padding: 1.4rem; }
.dialog-body .actions { justify-content: flex-end; margin-top: 1.2rem; }
.dialog-body pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  background: #18332f;
  color: #fff;
  padding: .9rem 1.3rem;
  border-radius: 6px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, .2);
  display: none;
  z-index: 20;
}
#toast.show { display: block; }

@media (min-width: 620px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preview-photo-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .detail-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .grid.settings-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .filter-row.admin-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1350px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  header { padding: 1rem; }
  .userbar small { display: none; }
  main { padding-top: 1.3rem; }
  nav { padding: .4rem .5rem; }
  nav a { padding: .6rem .7rem; font-size: .85rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { border-bottom: 1px solid var(--line); }
  .dialog-body, .dialog-head, .panel { padding: 1rem; }
  .heading { align-items: flex-start; }
  .detail-meta { grid-template-columns: 1fr; gap: .8rem; }
  .search-panel { padding: 1rem; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .auth { margin: 1.5rem auto; }
  .auth .panel { padding: 1.1rem; }
}
@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  header, nav, .no-print, footer, #toast, dialog, .demo-banner, .skip { display: none !important; }
  main { padding: 0; max-width: none; }
  .label-grid { display: block; }
  .part-label {
    display: inline-block;
    width: 60mm;
    min-height: 65mm;
    border: 1px dashed #aaa;
    margin: 1mm;
    padding: 2mm;
    vertical-align: top;
    break-inside: avoid;
  }
  .part-label img { width: 32mm; height: 32mm; max-width: 100%; }
  .label-controls { display: none; }
  .part-label .code { font-size: 10pt; }
  .part-label strong { font-size: 9pt; }
  .part-label small { font-size: 8pt; }
}
