@font-face {
  font-family: "LabelSans";
  src: url("fonts/DejaVuSans.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "LabelSans";
  src: url("fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "LabelCondensed";
  src: url("fonts/DejaVuSansCondensed.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "LabelCondensed";
  src: url("fonts/DejaVuSansCondensed-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

:root {
  --ink: #14201c;
  --muted: #68736e;
  --green-950: #10231d;
  --green-800: #174c3d;
  --green-700: #1e6550;
  --green-100: #e6f1ec;
  --cream: #f5f0e5;
  --gold: #c99b48;
  --white: #ffffff;
  --danger: #b53a36;
  --shadow: 0 18px 50px rgba(15, 39, 31, 0.12);
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(201, 155, 72, 0.18), transparent 25rem),
    linear-gradient(145deg, #f8f5ed 0%, #edf3ef 100%);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.screen-transition {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  color: white;
  background: #0b1713;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.015);
  transition: opacity .16s ease, transform .42s ease;
}
.screen-transition.active { opacity: 1; transform: scale(1); }
.screen-transition-photo { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 42%; }
.screen-transition-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,18,14,.08) 20%, rgba(5,18,14,.78) 100%); }
.screen-transition-brand {
  position: absolute;
  left: 50%;
  bottom: max(42px, calc(24px + env(safe-area-inset-bottom)));
  width: min(88%, 430px);
  display: grid;
  justify-items: center;
  text-align: center;
  transform: translateX(-50%);
  text-shadow: 0 3px 18px rgba(0,0,0,.62);
}
.screen-transition-brand img { width: 76px; height: 76px; margin-bottom: 10px; border: 2px solid rgba(255,255,255,.86); border-radius: 50%; object-fit: cover; box-shadow: 0 8px 26px rgba(0,0,0,.34); }
.screen-transition-brand strong { font-size: clamp(30px,8vw,44px); font-weight: 900; letter-spacing: -.025em; }
.screen-transition-brand span { margin-top: 3px; color: rgba(255,255,255,.82); font-size: 12px; font-weight: 800; letter-spacing: .08em; }

button, input { font: inherit; }
button { cursor: pointer; }

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

.mobile-session-strip,
.mobile-bottom-nav { display: none; }

.topbar {
  min-height: 92px;
  padding: 18px clamp(22px, 3vw, 48px);
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
  background: var(--green-950);
  box-shadow: 0 8px 30px rgba(7, 26, 20, 0.22);
}

.brand-logo {
  width: 54px;
  height: 54px;
  display: block;
  flex: 0 0 auto;
  border: 1px solid rgba(216, 173, 88, .55);
  border-radius: 50%;
  object-fit: cover;
  background: #231f20;
}

.brand-copy { min-width: 0; }

.brand-byline {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.65);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.eyebrow {
  margin: 0 0 3px;
  color: #dcb866;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1 { margin: 0; font-size: clamp(22px, 2.2vw, 32px); font-weight: 750; }

.daily-counters {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.daily-counter {
  min-width: 104px;
  min-height: 55px;
  padding: 7px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-items: center;
  column-gap: 9px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
}
.daily-counter span { grid-column: 1 / -1; color: rgba(255,255,255,.72); font-size: 9px; font-weight: 850; letter-spacing: .055em; }
.daily-counter strong { font-size: 26px; line-height: 1; }
.small-label-counter strong { color: #80dfad; }
.large-label-counter strong { color: #f0ca75; }

.activity-open-button,
.production-open-button {
  min-height: 45px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  color: white;
  background: rgba(255,255,255,.09);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .045em;
}
.activity-open-button span,
.production-open-button span { color: #f0ca75; font-size: 18px; line-height: 1; }
.activity-open-button:active,
.production-open-button:active { background: rgba(255,255,255,.18); }
.production-open-button { border-color: rgba(220,184,102,.55); color: #ffe2a0; background: rgba(201,155,72,.15); }

.printer-status {
  min-height: 45px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-size: 14px;
  font-weight: 650;
}

.admin-open-button {
  min-height: 45px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(220,184,102,.5);
  border-radius: 999px;
  color: #f3d792;
  background: rgba(201,155,72,.12);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .055em;
}
.admin-open-button span { color: var(--gold); font-size: 9px; }
.admin-open-button:active { background: rgba(201,155,72,.24); }

.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #d9a83f; box-shadow: 0 0 0 5px rgba(217,168,63,.13); }
.printer-status.ready .status-dot { background: #56d58f; box-shadow: 0 0 0 5px rgba(86,213,143,.13); }
.printer-status.error .status-dot { background: #ff746f; box-shadow: 0 0 0 5px rgba(255,116,111,.13); }

.workspace {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 42px);
  display: grid;
  grid-template-columns: minmax(320px, .78fr) minmax(570px, 1.22fr);
  gap: clamp(22px, 2.5vw, 38px);
}

.products-panel, .print-panel {
  min-width: 0;
  border: 1px solid rgba(23, 76, 61, 0.1);
  border-radius: 26px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.products-panel { padding: clamp(22px, 2.2vw, 34px); }
.print-panel { padding: clamp(22px, 2.2vw, 34px); }

.section-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading > div { display: flex; align-items: center; gap: 12px; }
.section-heading h2 { margin: 0; font-size: clamp(20px, 1.8vw, 27px); }
.section-heading.compact { margin-bottom: 19px; }

.step-number {
  width: 35px;
  height: 35px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--green-800);
  font-size: 17px;
  font-weight: 800;
}

.count-badge {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 13px;
  font-weight: 700;
}

.search-toolbar { margin: -4px 0 12px; }

.search-main-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.search-field {
  min-height: 62px;
  padding: 0 8px 0 18px;
  display: grid;
  grid-template-columns: 25px 1fr 46px;
  align-items: center;
  gap: 10px;
  border: 2px solid #d7e3dd;
  border-radius: 17px;
  background: white;
  box-shadow: 0 7px 20px rgba(16,35,29,.06);
}

.search-field:focus-within { outline: 4px solid rgba(30,101,80,.12); border-color: var(--green-700); }
.search-field input { min-width: 0; height: 56px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 20px; font-weight: 700; }
.search-field input::placeholder { color: #8a9691; font-weight: 600; }
.search-field button { width: 42px; height: 42px; border: 0; border-radius: 12px; color: var(--green-800); background: var(--green-100); font-size: 29px; line-height: 1; }
.search-field button[hidden] { display: none; }
.search-icon { width: 19px; height: 19px; position: relative; border: 3px solid var(--green-700); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; right: -7px; bottom: -5px; width: 9px; height: 3px; border-radius: 3px; background: var(--green-700); transform: rotate(45deg); }

.touch-search-toggle {
  min-width: 126px;
  min-height: 62px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 17px;
  color: white;
  background: var(--green-700);
  box-shadow: 0 7px 18px rgba(30,101,80,.2);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}
.touch-search-toggle span { font-size: 19px; }
.touch-search-toggle[aria-expanded="true"] { color: var(--green-800); background: #d9eee4; box-shadow: none; }

.touch-search-panel {
  margin-top: 10px;
  padding: 13px;
  border: 2px solid #c8ddd3;
  border-radius: 17px;
  background: #f4f9f6;
  box-shadow: 0 8px 22px rgba(16,35,29,.07);
}
.touch-search-panel[hidden] { display: none; }
.touch-panel-heading { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.touch-panel-heading > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.touch-panel-heading strong { color: var(--green-800); font-size: 11px; letter-spacing: .045em; }
.touch-panel-heading span { color: var(--muted); font-size: 10px; }
.touch-panel-heading button { min-height: 38px; padding: 0 11px; flex: 0 0 auto; border: 1px solid #b8d1c5; border-radius: 10px; color: var(--green-800); background: white; font-size: 9px; font-weight: 900; }
.touch-panel-actions { display: flex; align-items: center; gap: 6px; }
.touch-panel-heading .touch-search-close { width: 38px; padding: 0; font-size: 23px; line-height: 1; }

.touch-alphabet {
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 1fr));
  gap: 6px;
}
.touch-alphabet button {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 1px solid #c5d9cf;
  border-radius: 11px;
  color: var(--green-800);
  background: white;
  font-size: 16px;
  font-weight: 900;
}
.touch-alphabet button.active { border-color: var(--green-700); color: white; background: var(--green-700); box-shadow: 0 4px 10px rgba(30,101,80,.18); }
.touch-alphabet button:disabled { color: #a8b3ae; background: #edf1ef; }

.touch-shortcut-section { margin-top: 11px; }
.touch-section-label { display: block; margin-bottom: 6px; color: #6e7b75; font-size: 9px; font-weight: 900; letter-spacing: .055em; }
.touch-suggestions, .recent-products { display: flex; flex-wrap: wrap; gap: 6px; }
.touch-suggestions button, .recent-products button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #bdd4c9;
  border-radius: 11px;
  color: var(--green-800);
  background: white;
  font-size: 11px;
  font-weight: 850;
}
.recent-products button { border-color: #e1c681; color: #684c10; background: #fff8e5; }

.printer-filters {
  margin: 0 0 10px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  border-radius: 15px;
  background: #edf3f0;
}

.printer-filter {
  min-height: 48px;
  padding: 5px 8px;
  border: 0;
  border-radius: 11px;
  color: #49645a;
  background: transparent;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.12;
}
.printer-filter span { display: block; margin-top: 2px; color: #7b8984; font-size: 9px; font-weight: 750; }
.printer-filter.active { color: white; background: var(--green-700); box-shadow: 0 5px 14px rgba(30,101,80,.2); }
.printer-filter.active span { color: rgba(255,255,255,.8); }

.category-filters {
  margin: 0 0 15px;
  padding-bottom: 3px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.category-chip { min-height: 42px; padding: 0 15px; flex: 0 0 auto; border: 1px solid #d8e4de; border-radius: 999px; color: var(--green-800); background: #f7faf8; font-size: 13px; font-weight: 800; }
.category-chip.active { border-color: var(--green-700); color: white; background: var(--green-700); }

.product-grid {
  max-height: min(650px, 64vh);
  padding: 2px 4px 12px 2px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 13px;
  overflow-y: auto;
  align-content: start;
  scrollbar-width: thin;
}

.product-card {
  position: relative;
  min-height: 136px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  overflow: hidden;
  border: 2px solid #dfe9e4;
  border-radius: 21px;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #f5f8f6);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.product-card::after {
  content: "";
  position: absolute;
  right: -31px;
  bottom: -31px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: rgba(201,155,72,.13);
}

.product-card:active { transform: scale(.985); }
.product-card.selected { border-color: var(--green-700); box-shadow: 0 12px 28px rgba(30,101,80,.18); }
.product-card.selected::before { content: "✓"; position: absolute; top: 15px; right: 15px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green-700); font-weight: 900; }
.product-code { color: var(--green-700); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.product-name { max-width: 90%; font-size: clamp(20px, 1.55vw, 25px); font-weight: 800; line-height: 1.06; }
.product-format { color: var(--muted); font-size: 13px; font-weight: 650; }
.product-card.pending { border-style: dashed; }
.product-card.pending .product-code { color: #8a641d; }
.product-card.incomplete { border-color: #e4c9c7; background: linear-gradient(145deg, #fff, #fff7f6); }
.product-card.provisional { border-color: #e6cf91; background: linear-gradient(145deg, #fff, #fffaf0); }
.product-card.provisional .product-code { color: #8a641d; }
.card-status { position: absolute; right: 10px; bottom: 10px; z-index: 1; padding: 4px 7px; border-radius: 7px; color: #765617; background: #f5e8c8; font-size: 9px; font-weight: 900; letter-spacing: .045em; }
.product-card.incomplete .card-status { color: #963c37; background: #f8dedc; }
.product-card.pending .product-format, .product-card.incomplete .product-format, .product-card.provisional .product-format { max-width: 44%; }

.empty-products { min-height: 190px; padding: 30px; display: grid; place-content: center; gap: 7px; border: 2px dashed #d6e1dc; border-radius: 18px; color: var(--muted); text-align: center; }
.empty-products[hidden] { display: none; }
.empty-products strong { color: var(--ink); font-size: 20px; }

.model-status {
  margin: -2px 0 18px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  align-items: center;
  gap: 12px;
  border: 1px solid #bcd8ca;
  border-radius: 15px;
  background: #edf7f2;
}
.model-status > div { min-width: 0; display: flex; align-items: center; gap: 10px; }
.model-status span { padding: 5px 8px; flex: 0 0 auto; border-radius: 7px; color: white; background: var(--green-700); font-size: 9px; font-weight: 900; letter-spacing: .05em; }
.model-status strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.model-status p { margin: 0; color: #47655a; text-align: right; font-size: 11px; font-weight: 700; }
.model-status.pending { border-color: #e5c983; background: #fff9e9; }
.model-status.pending span { color: #563d0e; background: #e7bc55; }
.model-status.pending p { color: #765b22; }
.model-status.warning { border-color: #dfad58; background: #fff4dc; }
.model-status.warning span { color: #3f2c08; background: #d99324; }
.model-status.warning p { color: #765019; }
.model-status.blocked { border-color: #e1b1ae; background: #fff2f1; }
.model-status.blocked span { background: var(--danger); }
.model-status.blocked p { color: #873f3b; }
.model-status.warning,
.model-status.pending,
.model-status.blocked { grid-template-columns: 1fr; }
.model-status.warning strong,
.model-status.pending strong,
.model-status.blocked strong { white-space: normal; line-height: 1.15; }
.model-status.warning p,
.model-status.pending p,
.model-status.blocked p { text-align: left; }

.free-text-panel {
  margin: 0 0 17px;
  padding: 15px;
  border: 2px solid #c9ddd3;
  border-radius: 17px;
  background: #f3f8f5;
}
.free-text-panel[hidden] { display: none; }
.free-text-panel > label { display: flex; flex-direction: column; gap: 8px; }
.free-text-panel > label > span { color: var(--green-800); font-size: 13px; font-weight: 850; }
.free-text-panel textarea {
  width: 100%;
  min-height: 126px;
  padding: 14px 15px;
  resize: vertical;
  border: 2px solid #d5e3dc;
  border-radius: 14px;
  color: var(--ink);
  background: white;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.18;
}
.free-text-panel textarea:focus { outline: 4px solid rgba(30,101,80,.12); border-color: var(--green-700); }
.free-text-options { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-field { display: flex; align-items: center; gap: 9px; color: #405c51; font-size: 13px; font-weight: 750; }
.toggle-field input { width: 22px; height: 22px; accent-color: var(--green-700); }
.free-text-options output { color: var(--muted); font-size: 11px; font-weight: 750; }
[hidden] { display: none !important; }

.controls-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { color: var(--muted); font-size: 13px; font-weight: 750; }

input[type="date"] {
  width: 100%;
  height: 62px;
  padding: 0 16px;
  border: 2px solid #dce6e1;
  border-radius: 15px;
  color: var(--ink);
  background: white;
  font-size: clamp(20px, 1.8vw, 26px);
  font-weight: 750;
}

input[type="date"]:focus { outline: 4px solid rgba(30,101,80,.12); border-color: var(--green-700); }

.prefixed-input {
  height: 62px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  overflow: hidden;
  border: 2px solid #dce6e1;
  border-radius: 15px;
  background: white;
}
.prefixed-input:focus-within { outline: 4px solid rgba(30,101,80,.12); border-color: var(--green-700); }
.prefixed-input strong { padding-left: 16px; color: var(--green-800); font-size: 25px; }
.operator-input {
  width: 100%;
  height: 58px;
  padding: 0 16px 0 7px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  text-transform: uppercase;
  font-size: clamp(20px, 1.8vw, 26px);
  font-weight: 800;
}

.stepper {
  height: 62px;
  display: grid;
  grid-template-columns: 62px 1fr 62px;
  overflow: hidden;
  border: 2px solid #dce6e1;
  border-radius: 15px;
  background: white;
}

.stepper button { border: 0; color: var(--green-800); background: var(--green-100); font-size: 33px; font-weight: 600; }
.stepper button:active { background: #d2e8de; }
.stepper output { display: grid; place-items: center; font-size: 27px; font-weight: 850; }

.lot-summary {
  margin: 15px 0 17px;
  min-height: 49px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 13px;
  background: var(--cream);
}
.lot-summary span { color: #6b634f; font-size: 13px; font-weight: 700; }
.lot-summary strong { color: #483816; font-size: 21px; letter-spacing: .04em; }

.preview-heading { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.text-button { min-height: 36px; padding: 0 9px; border: 0; color: var(--green-700); background: transparent; font-size: 13px; font-weight: 800; }

.preview-frame {
  width: 100%;
  padding: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 17px;
  background: #dce2df;
  box-shadow: inset 0 0 0 1px rgba(16,35,29,.08);
}

#labelCanvas { width: min(100%, 760px); height: auto; display: block; background: white; box-shadow: 0 6px 18px rgba(0,0,0,.13); }

.print-button {
  width: 100%;
  min-height: 69px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 0;
  border-radius: 17px;
  color: white;
  background: linear-gradient(135deg, var(--green-700), var(--green-800));
  box-shadow: 0 13px 25px rgba(23,76,61,.23);
  font-size: clamp(17px, 1.65vw, 23px);
  font-weight: 850;
  letter-spacing: .025em;
}
.print-button:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 7px 16px rgba(23,76,61,.22); }
.print-button:disabled { cursor: not-allowed; opacity: .43; box-shadow: none; }
.print-button.printing { background: #7c8b85; }

.print-icon { width: 26px; height: 19px; position: relative; border-radius: 3px; background: currentColor; }
.print-icon::before { content: ""; position: absolute; left: 4px; right: 4px; top: -9px; height: 12px; border: 2px solid currentColor; background: var(--green-700); }
.print-icon::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: -5px; height: 10px; border: 2px solid var(--green-700); background: white; }

.only-date-note { margin: 12px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.mobile-back-button { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: min(520px, calc(100% - 32px));
  padding: 15px 20px;
  border-radius: 14px;
  color: white;
  background: var(--green-950);
  box-shadow: 0 14px 40px rgba(0,0,0,.24);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.preview-dialog {
  width: min(1000px, calc(100% - 34px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 23px;
  background: #dce2df;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
.preview-dialog::backdrop { background: rgba(7,23,18,.72); backdrop-filter: blur(5px); }
.dialog-topbar { padding: 16px 19px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--green-950); }
.dialog-topbar p { margin: 0 0 2px; color: #dcb866; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.dialog-topbar strong { font-size: 18px; }
.dialog-topbar button { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; color: white; background: rgba(255,255,255,.1); font-size: 30px; }
#largeCanvas { width: calc(100% - 36px); height: auto; margin: 18px; display: block; background: white; box-shadow: 0 6px 18px rgba(0,0,0,.15); }

.production-dialog {
  width: min(1220px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #eef3f0;
  box-shadow: 0 30px 100px rgba(0,0,0,.42);
}
.production-dialog::backdrop { background: rgba(7,23,18,.78); backdrop-filter: blur(6px); }
.production-dialog-topbar { position: sticky; top: 0; z-index: 5; }
.production-dialog-body { max-height: calc(100vh - 96px); padding: 18px; display: grid; grid-template-columns: minmax(360px,.9fr) minmax(460px,1.1fr); gap: 16px; overflow-y: auto; }
.production-dialog-body.operator-only { grid-template-columns: minmax(0,720px); justify-content: center; }
.production-entry-card, .production-day-card { min-width: 0; padding: 19px; border: 1px solid #d4e2db; border-radius: 19px; background: white; box-shadow: 0 8px 24px rgba(16,35,29,.07); }
.production-section-heading, .production-day-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 13px; }
.production-section-heading span, .production-day-toolbar > div > span { color: var(--green-700); font-size: 9px; font-weight: 950; letter-spacing: .08em; }
.production-section-heading h2, .production-day-toolbar h2 { margin: 3px 0 0; font-size: 23px; }
.production-section-heading > strong { padding: 7px 10px; border-radius: 9px; color: #6a4d12; background: #fff0c7; font-size: 9px; letter-spacing: .05em; }
.production-operator-notice { margin: 14px 0 0; padding: 10px 12px; border: 1px solid #d5c68f; border-radius: 11px; color: #6b531e; background: #fff7df; font-size: 9px; font-weight: 850; line-height: 1.45; }
.production-approval-notice { margin: 14px 0 0; padding: 10px 12px; border: 1px solid #9bc9b2; border-radius: 11px; color: #205c45; background: #eaf7f0; font-size: 10px; font-weight: 850; line-height: 1.45; }

.production-search-field { margin-top: 17px; display: grid; gap: 6px; }
.production-search-field > span, .production-form-grid label > span, .production-quantity-block > span, .production-day-toolbar label > span { color: var(--muted); font-size: 10px; font-weight: 900; }
.production-search-field > div { position: relative; }
.production-search-field input, .production-form-grid input, .production-form-grid select, .production-day-toolbar input, .production-history-filters input, .production-history-filters select {
  width: 100%;
  min-height: 50px;
  padding: 0 13px;
  border: 2px solid #d7e3dd;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font-size: 14px;
  font-weight: 720;
}
.production-search-field input { padding-right: 50px; font-size: 16px; }
.production-search-field input:focus, .production-form-grid input:focus, .production-form-grid select:focus, .production-day-toolbar input:focus, .production-history-filters input:focus, .production-history-filters select:focus, #productionQuantity:focus { outline: 4px solid rgba(30,101,80,.11); border-color: var(--green-700); }
#productionProductClear { position: absolute; top: 6px; right: 6px; width: 38px; height: 38px; border: 0; border-radius: 9px; color: var(--muted); background: #edf3f0; font-size: 23px; }
.production-product-results { max-height: 250px; margin-top: 7px; padding: 6px; overflow-y: auto; border: 1px solid #cbdcd3; border-radius: 13px; background: #f7faf8; box-shadow: 0 12px 26px rgba(16,35,29,.12); }
.production-product-result { width: 100%; min-height: 56px; padding: 9px 11px; display: grid; gap: 2px; border: 0; border-bottom: 1px solid #e0e9e4; color: var(--ink); background: transparent; text-align: left; }
.production-product-result:last-child { border-bottom: 0; }
.production-product-result:active { background: var(--green-100); }
.production-product-result strong { font-size: 13px; }
.production-product-result span { color: var(--muted); font-size: 9px; font-weight: 800; }
.production-selected-product { margin-top: 9px; padding: 11px 13px; display: grid; gap: 3px; border: 1px solid #abd2bf; border-radius: 12px; background: #eef9f3; }
.production-selected-product > span { color: var(--green-700); font-size: 8px; font-weight: 950; letter-spacing: .075em; }
.production-selected-product > strong { font-size: 15px; line-height: 1.2; }
.production-selected-product > small { color: var(--muted); font-size: 9px; font-weight: 750; }

.production-form-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.production-form-grid label { min-width: 0; display: grid; gap: 6px; }
.production-form-grid .production-employee-field { grid-column: 1 / -1; }
.production-form-grid .production-phase-field { grid-column: 1 / -1; }
.production-form-grid small { font-weight: 650; }
.production-form-grid input[readonly] { color: var(--green-950); border-color: #a9d1be; background: #eef9f3; font-weight: 900; }
.production-form-grid select:disabled { color: var(--green-950); opacity: 1; border-color: #a9d1be; background: #eef9f3; font-weight: 900; }
.production-quantity-block { margin-top: 12px; display: grid; gap: 7px; }
.production-quantity-row { display: grid; grid-template-columns: 56px minmax(0,1fr) 56px; gap: 7px; }
.production-quantity-row button { min-height: 58px; border: 0; border-radius: 13px; color: white; background: var(--green-700); font-size: 29px; font-weight: 900; }
#productionQuantity { min-width: 0; min-height: 58px; border: 2px solid #cbdcd3; border-radius: 13px; text-align: center; font-size: 27px; font-weight: 900; }
.production-unit-buttons { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.production-unit-buttons button { min-height: 43px; padding: 0 7px; border: 2px solid #d3e0da; border-radius: 11px; color: var(--green-800); background: white; font-size: 9px; font-weight: 950; }
.production-unit-buttons button.active { border-color: var(--green-700); color: white; background: var(--green-700); }
.production-form-error { margin: 11px 0 0; padding: 10px 12px; border-radius: 10px; color: #8f302c; background: #fee6e4; font-size: 11px; font-weight: 800; }
.production-save-button { width: 100%; min-height: 58px; margin-top: 14px; border: 0; border-radius: 14px; color: white; background: var(--green-700); box-shadow: 0 10px 23px rgba(30,101,80,.22); font-size: 13px; font-weight: 950; letter-spacing: .025em; }
.production-save-button:disabled { cursor: wait; opacity: .55; }
.production-saved-panel { margin-top: 11px; padding: 11px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid #9dceb6; border-radius: 13px; background: #e8f7ef; }
.production-saved-panel > div { min-width: 0; display: grid; gap: 2px; }
.production-saved-panel span { color: var(--green-700); font-size: 8px; font-weight: 950; letter-spacing: .07em; }
.production-saved-panel strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.production-saved-panel button { min-height: 43px; padding: 0 11px; border: 1px solid #8fbea8; border-radius: 10px; color: var(--green-800); background: white; font-size: 9px; font-weight: 950; }

.production-day-toolbar label { width: 150px; display: grid; gap: 5px; }
.production-access-button { min-height: 43px; padding: 0 13px; border: 1px solid #c1d7cc; border-radius: 11px; color: var(--green-800); background: #f7faf8; font-size: 9px; font-weight: 950; }
.production-history-filters { margin-top: 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.production-history-filters label { min-width: 0; display: grid; gap: 5px; }
.production-history-filters label > span { color: var(--muted); font-size: 10px; font-weight: 900; }
.production-history-query { grid-column: 1 / 4; }
.production-history-presets { display: grid; grid-template-columns: 1fr; gap: 5px; align-content: end; }
.production-history-presets button { min-height: 32px; padding: 0 8px; border: 1px solid #c2d6cc; border-radius: 8px; color: var(--green-800); background: white; font-size: 8px; font-weight: 950; }
.production-summary-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.production-summary-grid article { min-height: 86px; padding: 12px; display: grid; align-content: space-between; border: 1px solid #d6e3dd; border-radius: 14px; background: #f8faf9; }
.production-summary-grid span { color: var(--green-700); font-size: 8px; font-weight: 950; letter-spacing: .045em; }
.production-summary-grid strong { font-size: 28px; line-height: 1; }
.production-other-totals { margin: 8px 1px 0; padding: 8px 10px; border-radius: 9px; color: #5c4719; background: #fff4d6; font-size: 10px; font-weight: 850; }
.production-approval-totals { margin: 8px 1px 0; padding: 8px 10px; border-radius: 9px; color: #205c45; background: #eaf7f0; font-size: 10px; font-weight: 900; }
.production-list-heading { margin: 16px 0 8px; display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.production-list-heading > div:first-child { display: grid; gap: 2px; }
.production-list-heading strong { font-size: 16px; }
.production-list-heading span { color: var(--muted); font-size: 10px; font-weight: 700; }
.production-list-heading > div:last-child { display: flex; gap: 6px; }
.production-list-heading button { min-height: 38px; padding: 0 10px; border: 1px solid #c2d6cc; border-radius: 10px; color: var(--green-800); background: white; font-size: 9px; font-weight: 950; }
#productionTraceabilityButton { color: white; border-color: var(--green-700); background: var(--green-700); }
.production-entries { display: grid; gap: 8px; }
.production-entry-row { padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 12px; border: 1px solid #d9e4df; border-radius: 13px; background: #fbfcfb; }
.production-entry-row.voided { opacity: .72; background: #f4f4f4; }
.production-entry-row > div:first-child { min-width: 0; display: grid; gap: 3px; }
.production-entry-row strong { font-size: 13px; line-height: 1.2; }
.production-entry-row small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.production-entry-quantity { align-self: start; padding: 7px 9px; border-radius: 9px; color: var(--green-950); background: #e6f2ec; font-size: 14px; font-weight: 950; white-space: nowrap; }
.production-entry-details { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.production-entry-details span { padding: 4px 7px; border-radius: 7px; color: #54635d; background: #eef2f0; font-size: 8px; font-weight: 800; }
.production-entry-details .production-phase-badge { color: #fff; background: var(--green-700); }
.production-entry-details .production-phase-badge.cottura { background: #9a5c16; }
.production-entry-details .production-phase-badge.decorazione { background: #7a3d78; }
.production-phase-totals { margin: 7px 0 0; color: var(--green-800); font-size: 10px; font-weight: 900; }
.production-confirmation-badge { grid-column: 1 / -1; width: fit-content; padding: 6px 9px; border-radius: 8px; color: #684b0f; background: #fff0c7; font-size: 9px; font-weight: 950; }
.production-confirmation-badge.confirmed { color: #205c45; background: #dff3e9; }
.production-entry-confirm { grid-column: 1 / -1; min-height: 44px; border: 0; border-radius: 10px; color: white; background: var(--green-700); box-shadow: 0 7px 17px rgba(30,101,80,.2); font-size: 10px; font-weight: 950; }
.production-entry-confirm:disabled { opacity: .5; }
.production-entry-void { grid-column: 1 / -1; min-height: 36px; border: 1px solid #e5bab7; border-radius: 9px; color: #9b3732; background: #fff5f4; font-size: 9px; font-weight: 950; }
.production-empty { padding: 42px 16px; display: grid; gap: 4px; color: var(--muted); text-align: center; }
.production-empty strong { color: var(--ink); }
.production-report-status { margin-top: 11px; padding: 10px 12px; display: grid; gap: 3px; border: 1px solid #d5c68f; border-radius: 11px; color: #6b531e; background: #fff7df; }
.production-report-status strong { font-size: 9px; letter-spacing: .055em; }
.production-report-status span { font-size: 9px; line-height: 1.4; }
.production-report-status.ready { border-color: #a4cfba; color: #205c45; background: #eaf7f0; }
.production-report-status.error { border-color: #e2aaa6; color: #8b332f; background: #fff0ef; }
.production-audit-note { margin: 11px 1px 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.production-access-panel { margin-top: 15px; padding: 14px; border: 2px solid #cbdcd3; border-radius: 15px; background: #f7faf8; }
.production-access-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.production-access-heading span { color: var(--green-700); font-size: 9px; font-weight: 950; letter-spacing: .06em; }
.production-access-heading h3 { margin: 3px 0 0; font-size: 20px; }
.production-access-heading button { width: 38px; height: 38px; border: 1px solid #c5d7cf; border-radius: 10px; color: var(--green-800); background: white; font-size: 22px; }
.production-access-panel > p:not(.production-form-error) { margin: 9px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.production-approver-count { display: block; margin: 9px 0; color: var(--green-800); font-size: 11px; }
.production-access-users { display: grid; gap: 8px; }
.production-access-user { padding: 12px; display: grid; gap: 10px; border: 1px solid #d6e3dd; border-radius: 12px; background: white; }
.production-access-user-head { min-width: 0; display: grid; gap: 2px; }
.production-access-user-head strong { overflow-wrap: anywhere; font-size: 12px; }
.production-access-user-head span { overflow-wrap: anywhere; color: var(--muted); font-size: 9px; }
.production-access-user-role { width: fit-content; margin-top: 3px; padding: 4px 7px; border-radius: 7px; color: var(--green-800) !important; background: #eaf3ef; font-weight: 900; }
.production-access-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.production-access-options label { min-height: 48px; padding: 8px 9px; display: flex; align-items: center; gap: 8px; border: 1px solid #d5e1db; border-radius: 10px; color: #40534c; background: #fbfcfb; font-size: 9px; font-weight: 850; line-height: 1.3; }
.production-access-options input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--green-700); }
.production-access-options input:disabled { opacity: .45; }

.activity-dialog {
  width: min(1320px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #f6f8f6;
  box-shadow: 0 30px 100px rgba(0,0,0,.42);
}
.activity-dialog::backdrop { background: rgba(7,23,18,.78); backdrop-filter: blur(6px); }
.activity-dialog-topbar { position: sticky; top: 0; z-index: 3; }
.activity-dialog-body { max-height: calc(100vh - 96px); padding: 20px 23px 25px; overflow-y: auto; }
.activity-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 11px; }
.activity-summary-grid article { min-height: 106px; padding: 15px 17px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 3px 10px; border: 1px solid #d5e3dc; border-radius: 16px; background: white; box-shadow: 0 7px 18px rgba(16,35,29,.05); }
.activity-summary-grid span { grid-column: 1 / -1; color: var(--green-700); font-size: 10px; font-weight: 900; letter-spacing: .055em; }
.activity-summary-grid strong { font-size: 36px; line-height: 1; }
.activity-summary-grid small { color: var(--muted); font-size: 10px; font-weight: 700; }
.activity-summary-grid .activity-error-card span, .activity-summary-grid .activity-error-card strong { color: var(--danger); }

.activity-filters { margin-top: 14px; padding: 14px; display: grid; grid-template-columns: 150px 150px minmax(210px,1fr) 180px auto auto; align-items: end; gap: 9px; border: 1px solid #d8e4de; border-radius: 16px; background: white; }
.activity-filters label { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.activity-filters label span { color: var(--muted); font-size: 10px; font-weight: 850; }
.activity-filters input, .activity-filters select { width: 100%; min-height: 45px; padding: 0 11px; border: 2px solid #d7e3dd; border-radius: 11px; color: var(--ink); background: white; font-size: 12px; font-weight: 700; }
.activity-filters input:focus, .activity-filters select:focus { outline: 4px solid rgba(30,101,80,.11); border-color: var(--green-700); }
.activity-primary-button, .activity-secondary-button { min-height: 45px; padding: 0 14px; border-radius: 11px; font-size: 10px; font-weight: 900; }
.activity-primary-button { border: 0; color: white; background: var(--green-700); }
.activity-secondary-button { border: 2px solid #bcd2c7; color: var(--green-800); background: white; }

.activity-table-heading { margin: 16px 2px 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.activity-table-heading > div { display: flex; align-items: baseline; gap: 9px; }
.activity-table-heading strong { font-size: 17px; }
.activity-table-heading span { color: var(--muted); font-size: 11px; font-weight: 700; }
.activity-table-heading button { min-height: 38px; padding: 0 12px; border: 1px solid #c7d9d0; border-radius: 10px; color: var(--green-800); background: white; font-size: 10px; font-weight: 900; }
.activity-table-wrap { overflow-x: auto; border: 1px solid #d7e2dc; border-radius: 14px; background: white; }
.activity-table { width: 100%; min-width: 1040px; border-collapse: collapse; font-size: 11px; }
.activity-table th { position: sticky; top: 0; z-index: 1; padding: 11px 10px; color: white; background: var(--green-800); text-align: left; font-size: 9px; letter-spacing: .04em; }
.activity-table td { padding: 10px; border-bottom: 1px solid #e3ebe7; vertical-align: top; line-height: 1.3; }
.activity-table tr:last-child td { border-bottom: 0; }
.activity-table tr.activity-row-error td { color: #88332f; background: #fff6f5; }
.activity-table .activity-product-cell { min-width: 210px; font-weight: 800; }
.activity-table .activity-copy-cell { text-align: center; font-size: 16px; font-weight: 900; }
.activity-format-badge, .activity-result-badge { display: inline-block; padding: 4px 7px; border-radius: 7px; font-size: 9px; font-weight: 900; }
.activity-format-badge.small { color: #185740; background: #dff3e9; }
.activity-format-badge.large { color: #725311; background: #fff0c8; }
.activity-result-badge.ok { color: #185740; background: #dff3e9; }
.activity-result-badge.error { color: #923531; background: #ffe0de; }
.activity-empty { padding: 46px 18px; color: var(--muted); text-align: center; font-weight: 750; }
.activity-storage-note { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }

.admin-dialog {
  width: min(1180px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #f7f9f7;
  box-shadow: 0 30px 100px rgba(0,0,0,.42);
}
.admin-dialog::backdrop { background: rgba(7,23,18,.78); backdrop-filter: blur(6px); }
.admin-dialog-topbar { position: sticky; top: 0; z-index: 4; }

.admin-auth-view {
  width: min(470px, calc(100% - 34px));
  min-height: 480px;
  margin: 0 auto;
  padding: 64px 0 54px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
}
.admin-auth-view h2 { margin: 18px 0 8px; font-size: 29px; }
.admin-auth-view > p { margin: 0 0 23px; color: var(--muted); line-height: 1.45; }
.admin-lock-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 3px solid #cda554;
  border-radius: 24px;
  color: #775717;
  background: #fff6df;
  font-size: 20px;
  font-weight: 900;
}
.admin-pin-field { margin-bottom: 14px; display: flex; flex-direction: column; align-items: stretch; gap: 7px; text-align: left; }
.admin-pin-field span { color: var(--green-800); font-size: 12px; font-weight: 850; }
.admin-pin-field input {
  height: 66px;
  padding: 0 18px;
  border: 2px solid #d4e1db;
  border-radius: 15px;
  color: var(--ink);
  background: white;
  text-align: center;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: .3em;
}

.admin-primary-button, .admin-secondary-button, .admin-danger-button {
  min-height: 56px;
  padding: 0 21px;
  border: 0;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .025em;
}
.admin-primary-button { color: white; background: var(--green-700); box-shadow: 0 9px 20px rgba(30,101,80,.2); }
.admin-secondary-button { border: 2px solid #bcd2c7; color: var(--green-800); background: white; }
.admin-danger-button { border: 2px solid #e5b8b5; color: #9a322e; background: #fff4f3; }
.admin-primary-button:disabled, .admin-secondary-button:disabled, .admin-danger-button:disabled { cursor: not-allowed; opacity: .45; }
.admin-inline-error { margin: 0 0 13px !important; padding: 11px 13px; border-radius: 11px; color: #8f302c !important; background: #fee6e4; font-size: 12px; font-weight: 800; text-align: left; }

.admin-editor-view { max-height: calc(100vh - 92px); padding: 22px 25px 28px; overflow-y: auto; }
.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(220px,.85fr) minmax(280px,1.15fr) auto;
  align-items: end;
  gap: 13px;
}
.admin-search-field, .admin-select-field { display: flex; flex-direction: column; gap: 6px; }
.admin-search-field span, .admin-select-field span, .admin-form-grid label > span, .admin-approver-field span { color: var(--muted); font-size: 11px; font-weight: 850; }
.admin-search-field input, .admin-select-field select, .admin-form-grid input, .admin-form-grid select, .admin-form-grid textarea, .admin-approver-field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid #d7e3dd;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font-size: 14px;
  font-weight: 680;
}
.admin-form-grid textarea { resize: vertical; line-height: 1.35; }
.admin-search-field input:focus, .admin-select-field select:focus, .admin-form-grid input:focus, .admin-form-grid select:focus, .admin-form-grid textarea:focus, .admin-approver-field input:focus, .admin-pin-field input:focus { outline: 4px solid rgba(30,101,80,.11); border-color: var(--green-700); }
.admin-session-actions { display: flex; gap: 7px; }
.admin-session-actions button { min-height: 48px; padding: 0 12px; border: 1px solid #d5e1db; border-radius: 11px; color: var(--green-800); background: white; font-size: 10px; font-weight: 900; }
.admin-session-actions .admin-new-product-button { border-color: var(--green-700); color: white; background: var(--green-700); }

.admin-model-heading { margin: 20px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.admin-model-heading h2 { margin: 4px 0 0; font-size: clamp(22px,2.2vw,31px); }
#adminPrinterBadge { color: var(--green-700); font-size: 11px; font-weight: 900; letter-spacing: .07em; }
.admin-approval-badge { padding: 8px 11px; border-radius: 9px; color: white; background: var(--green-700); font-size: 10px; letter-spacing: .045em; }
.admin-approval-badge.pending { color: #63470d; background: #f1ce78; }
.admin-approval-badge.blocked { background: var(--danger); }

.admin-notice { margin: 0 0 15px; padding: 13px 15px; border: 1px solid #dfc47f; border-radius: 13px; color: #6e541f; background: #fff8e6; font-size: 12px; font-weight: 720; line-height: 1.4; }
.admin-custom-notice { border-color: #a9d1be; color: #285c49; background: #eef9f3; }
.admin-review-issues { margin: 0 0 15px; padding: 13px 15px; border: 1px solid #e2b7b4; border-radius: 13px; color: #7f3430; background: #fff2f1; font-size: 12px; }
.admin-review-issues strong { display: block; margin-bottom: 5px; }
.admin-review-issues ul { margin: 0; padding-left: 20px; line-height: 1.45; }
.admin-source-notices, .admin-alternative-source { margin: 0 0 15px; padding: 13px 15px; border: 1px solid #dfc47f; border-radius: 13px; color: #6e541f; background: #fff8e6; font-size: 12px; }
.admin-source-notices strong, .admin-alternative-source strong { display: block; margin-bottom: 5px; }
.admin-source-notices ul { margin: 0; padding-left: 20px; line-height: 1.45; }
.admin-alternative-source p { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.admin-form-grid label { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-form-grid .admin-wide-field { grid-column: 1 / -1; }
.admin-form-grid textarea:disabled { color: #7c8581; background: #eef1ef; }

.admin-approval-panel { margin-top: 18px; padding: 17px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 18px; border: 2px solid #d5e2dc; border-radius: 16px; background: white; }
.admin-approval-panel > div { grid-column: 1 / -1; }
.admin-approval-panel h3 { margin: 0 0 3px; font-size: 18px; }
.admin-approval-panel p { margin: 0; color: var(--muted); font-size: 12px; }
.admin-approval-panel > label:not(.admin-approver-field) { display: flex; align-items: flex-start; gap: 9px; color: #40534c; font-size: 12px; font-weight: 720; line-height: 1.35; }
.admin-approval-panel input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--green-700); }
.admin-approver-field { grid-column: 1 / -1; display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; }
.admin-audit-info { grid-column: 1 / -1; padding-top: 3px; color: #537064 !important; font-weight: 750; }
.admin-bottom-actions { position: sticky; bottom: -28px; z-index: 3; margin: 18px -25px -28px; padding: 15px 25px 22px; display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 11px; border-top: 1px solid #d9e3de; background: rgba(247,249,247,.96); backdrop-filter: blur(7px); }

@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; }
  .daily-counters { order: 5; width: 100%; margin-left: 0; }
  .daily-counter { flex: 1; }
  .workspace { grid-template-columns: 1fr; }
  .products-panel { padding-bottom: 25px; }
  .product-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .product-card { min-height: 125px; }
  .product-grid { max-height: 560px; }
  .admin-toolbar { grid-template-columns: 1fr 1fr; }
  .admin-session-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .activity-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .activity-query-field { grid-column: 1 / -1; }
  .production-dialog-body { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .app-shell { min-height: calc(100vh - 74px); }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 0;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 7px 9px;
    box-shadow: 0 10px 30px rgba(7,26,20,.22);
  }
  .brand-logo { width: 42px; height: 42px; }
  .brand-copy { min-width: 0; }
  .eyebrow { display: none; }
  .topbar h1 { max-width: none; font-size: 17px; line-height: 1.05; }
  .brand-byline { margin-top: 1px; font-size: 9px; }
  .topbar > .activity-open-button,
  .topbar > .production-open-button,
  .topbar > .admin-open-button { display: none; }
  .daily-counters { grid-column: 1 / -1; grid-row: 2; width: 100%; margin: 0; gap: 6px; }
  .daily-counter { min-width: 0; min-height: 34px; padding: 4px 9px; grid-template-columns: 1fr auto; grid-template-rows: 1fr; }
  .daily-counter span { grid-column: auto; font-size: 7px; }
  .daily-counter strong { font-size: 18px; }
  .printer-status { grid-column: 3; grid-row: 1; min-width: 0; max-width: 132px; min-height: 36px; padding: 0 9px; font-size: 11px; }
  .status-dot { width: 9px; height: 9px; }
  .activity-open-button, .production-open-button, .admin-open-button { min-height: 39px; padding: 0 10px; font-size: 9px; }
  .activity-open-button { margin-left: auto; }
  #printerStatusText { max-width: 94px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .workspace { padding: 10px; display: block; }
  .products-panel, .print-panel { padding: 16px; border-radius: 18px; }
  html[data-mobile-view="products"] .print-panel { display: none; }
  html[data-mobile-view="print"] .products-panel { display: none; }
  .products-panel {
    min-height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    scroll-margin-top: 110px;
    backdrop-filter: none;
  }
  .print-panel { min-height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .section-heading { margin-bottom: 17px; }
  .section-heading h2 { font-size: 20px; }
  .section-heading.compact { align-items: center; }
  .mobile-back-button { min-height: 38px; padding: 0 10px; display: inline-flex; align-items: center; border: 1px solid #c9dbd2; border-radius: 10px; color: var(--green-800); background: #f3f8f5; font-size: 10px; font-weight: 900; }
  .product-grid { max-height: 43vh; overscroll-behavior: contain; }
  .product-card { min-height: 105px; padding: 15px; }
  .print-button { position: static; box-shadow: 0 13px 32px rgba(16,35,29,.28); }
  .controls-row { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .model-status { grid-template-columns: 1fr; }
  .model-status > div { display: grid; grid-template-columns: 1fr; align-items: start; gap: 7px; }
  .model-status span { width: fit-content; max-width: 100%; white-space: normal; line-height: 1.2; }
  .model-status strong { white-space: normal; line-height: 1.15; }
  .model-status p { text-align: left; }
  .printer-filters { grid-template-columns: repeat(2, 1fr); }
  .search-main-row { grid-template-columns: 1fr; }
  .touch-search-toggle { min-height: 48px; }
  .touch-alphabet { grid-template-columns: repeat(6, minmax(38px,1fr)); }
  .touch-search-panel {
    position: fixed;
    inset: calc(96px + env(safe-area-inset-top)) 10px calc(76px + env(safe-area-inset-bottom));
    z-index: 45;
    margin: 0;
    padding: 15px;
    overflow-y: auto;
    border-color: #b9d2c6;
    border-radius: 19px;
    box-shadow: 0 22px 60px rgba(7,26,20,.32);
  }
  .touch-panel-heading { position: sticky; top: -15px; z-index: 2; margin: -15px -15px 12px; padding: 14px 15px 10px; background: #f4f9f6; }
  .activity-dialog { width: calc(100% - 12px); max-height: calc(100vh - 12px); border-radius: 17px; }
  .activity-dialog-body { padding: 14px; }
  .activity-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .activity-summary-grid article { min-height: 92px; padding: 12px; }
  .activity-summary-grid strong { font-size: 30px; }
  .activity-filters { grid-template-columns: 1fr; }
  .activity-query-field { grid-column: 1; }
  .activity-table-heading { align-items: flex-start; }
  .activity-table-heading > div { flex-direction: column; gap: 2px; }
  .production-dialog { width: 100%; max-width: none; max-height: 100dvh; margin: 0; border-radius: 0; }
  .production-dialog-body { max-height: calc(100dvh - 76px); padding: 10px; gap: 10px; }
  .production-entry-card, .production-day-card { padding: 14px; border-radius: 16px; }
  .production-section-heading h2, .production-day-toolbar h2 { font-size: 20px; }
  .production-form-grid { grid-template-columns: 1fr; }
  .production-unit-buttons { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .production-unit-buttons button { min-height: 46px; }
  .production-day-toolbar { align-items: end; }
  .production-day-toolbar label { width: 132px; }
  .production-day-toolbar { align-items: flex-start; }
  .production-access-button { min-height: 40px; padding: 0 9px; }
  .production-history-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .production-history-query, .production-history-presets { grid-column: 1 / -1; }
  .production-history-presets { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .production-history-presets button { min-height: 40px; }
  .production-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .production-list-heading { align-items: flex-start; flex-direction: column; }
  .production-list-heading > div:last-child { width: 100%; }
  .production-list-heading button { min-height: 43px; flex: 1; }
  #productionTraceabilityButton { flex-basis: 100%; }
  .production-saved-panel { grid-template-columns: 1fr; }
  .production-saved-panel strong { white-space: normal; }
  .production-saved-panel button { min-height: 47px; }
  .production-access-options { grid-template-columns: 1fr; }
  .admin-dialog { width: calc(100% - 12px); max-height: calc(100vh - 12px); border-radius: 17px; }
  .admin-editor-view { padding: 16px 14px 23px; }
  .admin-toolbar, .admin-form-grid, .admin-approval-panel { grid-template-columns: 1fr; }
  .admin-toolbar > *, .admin-form-grid .admin-wide-field, .admin-approval-panel > div, .admin-approver-field, .admin-audit-info { grid-column: 1; }
  .admin-session-actions { justify-content: stretch; }
  .admin-session-actions button { flex: 1; }
  .admin-approver-field { display: flex; flex-direction: column; align-items: stretch; }
  .admin-bottom-actions { bottom: -23px; margin: 16px -14px -23px; padding: 12px 14px 16px; grid-template-columns: 1fr; }

  .mobile-session-strip {
    min-height: 36px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(16,35,29,.12);
    color: var(--green-950);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
  }
  .mobile-session-identity { min-width: 0; display: grid; gap: 2px; }
  .mobile-session-strip span { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
  .mobile-session-strip strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-session-actions { display: flex; align-items: center; gap: 6px; }
  .mobile-session-strip button {
    min-height: 34px;
    padding: 0 11px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    color: var(--green-950);
    background: var(--gold);
    font-size: 9px;
    font-weight: 950;
  }
  .mobile-session-strip .mobile-logout-button { color: white; background: var(--green-950); }
  .mobile-session-strip button[hidden] { display: none; }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 5px;
    border-top: 1px solid rgba(255,255,255,.14);
    background: rgba(16,35,29,.98);
    box-shadow: 0 -14px 34px rgba(7,26,20,.22);
    backdrop-filter: blur(12px);
  }
  .mobile-bottom-nav button {
    min-height: 54px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    border-radius: 14px;
    color: rgba(255,255,255,.65);
    background: transparent;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .04em;
  }
  .mobile-bottom-nav button span { font-size: 21px; line-height: 1; }
  .mobile-bottom-nav button.active { color: var(--green-950); background: var(--gold); }
  html[data-user-role="operator"] #mobileManageButton { display: none; }
  html[data-user-role="operator"] .admin-open-button { display: none; }
  html[data-user-role="operator"] .mobile-bottom-nav { grid-template-columns: repeat(4,minmax(0,1fr)); }

  .preview-dialog,
  .production-dialog,
  .activity-dialog,
  .admin-dialog {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
