:root {
  --bg: #f7faf8;
  --surface: #ffffff;
  --surface-soft: #fff8dc;
  --ink: #183028;
  --muted: #64746d;
  --line: #dbe7df;
  --green: #ffc92e;
  --green-soft: #fff4c2;
  --green-ink: #4c3700;
  --amber: #b97800;
  --amber-soft: #fff2c7;
  --red: #c4362e;
  --red-soft: #ffe1de;
  --blue: #2767b1;
  --blue-soft: #e2efff;
  --plum: #6b3f7a;
  --shadow: 0 14px 34px rgba(23, 64, 48, .09);
}

* { box-sizing: border-box; }

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

body.role-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

button:active {
  transform: translateY(1px) scale(.99);
}

.role-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, #fff1ae 0, transparent 34%), var(--bg);
}

.role-screen .role-sheet-button {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 2;
  margin: 0;
}

.role-screen.hidden {
  display: none;
}

.role-panel {
  width: 100%; max-width: 980px;
  text-align: center;
}

.app-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 10px;
  background: #ffc92e;
  color: #153127;
  font-size: 31px;
  font-weight: 950;
}

.role-panel h1 {
  margin-bottom: 28px;
  font-size: 42px;
}

.role-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -9px;
}

.role-card, .module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.role-card {
  -webkit-flex: 0 0 calc(33.333% - 18px);
  flex: 0 0 calc(33.333% - 18px);
  margin: 9px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-gap: 12px;
  gap: 12px;
  min-height: 230px;
  padding: 22px;
}

.role-card:hover, .module-card:hover {
  border-color: #ffc92e;
  transform: translateY(-2px);
}

.role-card svg {
  width: 42px;
  height: 42px;
  color: var(--green);
}

.role-card strong {
  font-size: 28px;
}

.role-card span, .module-card span {
  color: var(--muted);
}

.pin-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(18, 52, 44, .55);
}

.pin-modal[hidden] {
  display: none;
}

.pin-panel {
  position: relative;
  width: 100%; max-width: 380px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pin-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.pin-display {
  display: flex;
  justify-content: center;
  grid-gap: 10px;
  gap: 10px;
  margin: 10px 0 16px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.pin-dot.filled {
  border-color: var(--green);
  background: var(--green);
}

.pin-keyboard {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -5px;
}

.pin-keyboard button,
.pin-keyboard .pin-spacer {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: calc(33.333% - 10px);
  margin: 5px;
  min-height: 76px;
}

.pin-keyboard button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f0f5f2;
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pin-keyboard button:active {
  background: #d5e8de;
}

.pin-keyboard .pin-spacer {
  border: none;
  background: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.sidebar {
  display: none;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #12342c;
  color: #f7fffb;
}

.brand {
  display: flex;
  align-items: center;
  grid-gap: 12px;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 22px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffc92e;
  color: #153127;
  font-weight: 900;
}

.brand strong, .brand span {
  display: block;
}

.brand span {
  color: #bfd6cc;
  font-size: 13px;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  grid-gap: 6px;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  grid-gap: 10px;
  gap: 10px;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #dbece4;
  text-align: left;
}

.nav-item:hover, .nav-item.active {
  background: #235547;
  color: #ffffff;
}

.nav-item svg, .icon-button svg, .primary-button svg, .secondary-button svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  grid-gap: 18px;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0 14px;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(247,250,248,0));
  backdrop-filter: blur(10px);
}

.topbar > div:first-of-type {
  flex: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.2;
}

.topbar-actions, .panel-heading, .section-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-gap: 12px;
  gap: 12px;
}

.icon-button, .primary-button, .secondary-button, .ghost-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-gap: 8px;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.back-button {
  display: none;
}

.back-button.visible {
  display: inline-flex;
}

.primary-button {
  background: var(--green);
  color: var(--green-ink);
  border-color: var(--green);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(255, 201, 46, .24);
}

.secondary-button {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #b9d4f3;
  font-weight: 800;
}

.field-button {
  width: 100%;
  min-height: 52px;
  margin-bottom: 8px;
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f0b5b0;
  font-weight: 900;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.ghost-button {
  background: transparent;
  color: var(--green-ink);
  border-color: transparent;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn .18s ease-out;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.network-pill {
  display: inline-flex;
  align-items: center;
  grid-gap: 6px;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.network-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.network-pill.offline {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f0b5b0;
}

.network-pill.offline::before {
  background: var(--red);
}

.network-pill.pending {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #f4cd71;
}

.network-pill.pending::before {
  background: var(--amber);
}

.welcome-band {
  display: flex;
  justify-content: space-between;
  grid-gap: 16px;
  gap: 16px;
  align-items: center;
  min-height: 116px;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12342c;
  color: white;
  box-shadow: var(--shadow);
}

.welcome-band span {
  display: inline-flex;
  margin-bottom: 8px;
  color: #ffc92e;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 13px;
}

.welcome-band h2 {
  font-size: 30px;
}

.module-grid, .product-choice-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -8px;
}

.module-card, .product-choice-card {
  -webkit-flex: 0 0 calc(25% - 16px);
  flex: 0 0 calc(25% - 16px);
  margin: 8px;
  box-sizing: border-box;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-gap: 12px;
  gap: 12px;
  padding: 18px;
  text-align: center;
}

.product-choice-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.product-choice-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}

px;
  height: 40px;
  color: var(--green);
}

.module-card strong, .product-choice-card strong {
  font-size: 24px;
}

.product-choice-card span {
  color: var(--muted);
}

.production-form-grid {
  margin-top: 16px;
}

.is-hidden {
  display: none !important;
}

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

.metric, .panel, .form-panel, .label-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel:hover, .form-panel:focus-within, .label-preview:hover {
  border-color: #c9d9d0;
  box-shadow: 0 18px 38px rgba(23, 64, 48, .12);
}

.metric {
  padding: 16px;
  min-height: 108px;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.dashboard-grid, .forms-grid, .settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
  grid-gap: 16px;
  gap: 16px;
}

.span-2 {
  grid-row: span 2;
}

.panel, .form-panel, .label-preview {
  padding: 18px;
}

.panel-heading {
  margin-bottom: 14px;
}

.task-list, .cold-list, .alert-list, .record-list, .integration-list, .threshold-list {
  display: grid;
  grid-gap: 10px;
  gap: 10px;
}

.task, .cold-row, .record, .integration-list div, .threshold-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  grid-gap: 12px;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.task button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.task button:disabled {
  cursor: not-allowed;
  background: #f1f5f3;
  color: var(--muted);
}

.task.done {
  opacity: .62;
}

.task.locked {
  opacity: .78;
}

.task.done .task-title {
  text-decoration: line-through;
}

.task-title, .record strong {
  display: block;
  font-weight: 800;
}

.task-meta, .cold-row span, .record span, .threshold-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.ok { background: var(--green-soft); color: var(--green-ink); }
.warn { background: var(--amber-soft); color: var(--amber); }
.bad { background: var(--red-soft); color: var(--red); }
.neutral { background: #eee8f2; color: var(--plum); }

.section-band {
  min-height: 86px;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-band p {
  margin: 6px 0 0;
  color: var(--muted);
}

.sensor-grid {
  display: grid;
  grid-gap: 16px;
  gap: 16px;
  margin-bottom: 16px;
}

.sensor-zone {
  display: grid;
  grid-gap: 10px;
  gap: 10px;
}

.sensor-zone-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.sensor-zone-heading h3 {
  margin: 0;
  font-size: 19px;
}

.sensor-zone-heading span,
.cold-zone-label,
.settings-zone-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.sensor-zone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-gap: 14px;
  gap: 14px;
}

.cold-zone-label {
  padding-top: 8px;
}

.cleaning-grid {
  display: grid;
  grid-gap: 12px;
  gap: 12px;
  margin-bottom: 16px;
}

.sensor-tile, .cleaning-item {
  min-height: 174px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sensor-tile strong {
  display: block;
  font-size: 18px;
}

.sensor-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  grid-gap: 8px;
  gap: 8px;
}

.temp-value {
  display: block;
  margin: 18px 0 8px;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.form-panel {
  display: grid;
  grid-gap: 14px;
  gap: 14px;
  align-content: start;
}

label {
  display: grid;
  grid-gap: 7px;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.input-unit {
  position: relative;
}

.input-unit input {
  padding-right: 46px;
}

.input-unit span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 900;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  background: #f1f7f3;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.cleaning-item {
  display: grid;
  grid-gap: 14px;
  gap: 14px;
  align-content: space-between;
}

.cleaning-item button {
  width: 100%;
}

.cleaning-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cleaning-area-head {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  grid-gap: 12px;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
}

.cleaning-area-head strong {
  display: block;
  font-size: 20px;
}

.cleaning-area-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cleaning-subtasks {
  display: none;
  grid-gap: 10px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.cleaning-area.open .cleaning-subtasks {
  display: grid;
}

.cleaning-subtask {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 190px) auto auto;
  align-items: center;
  grid-gap: 12px;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.cleaning-subtask.done {
  opacity: .72;
}

.cleaning-subtask.late {
  border-color: #f0b5b0;
  background: #fff7f6;
}

.cleaning-subtask span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.clean-frequency {
  min-height: 40px;
}

.manager-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 10px;
  gap: 10px;
  margin-bottom: 12px;
}

.button-row, .record-actions {
  display: flex;
  flex-wrap: wrap;
  grid-gap: 8px;
  gap: 8px;
}

.record-actions {
  justify-content: flex-end;
}

.danger-text {
  color: var(--red);
}

.metric.mini {
  min-height: 78px;
  padding: 12px;
  box-shadow: none;
}

.metric.mini strong {
  margin-top: 4px;
  font-size: 25px;
}

.label-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-gap: 18px;
  gap: 18px;
  min-height: 390px;
  text-align: center;
}

.label-card {
  width: 100%; max-width: 320px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  align-items: center;
  grid-gap: 6px;
  gap: 6px;
  padding: 14px;
  border: 2px solid #101d18;
  background: white;
  color: #101d18;
  text-align: left;
}

.label-card strong {
  grid-column: 1 / -1;
  font-size: 22px;
  line-height: 1.05;
}

.label-card b {
  font-size: 21px;
}

.label-card small {
  color: #33423d;
}

.qr-mark, .lot-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #101d18;
  background:
    linear-gradient(90deg, #101d18 9px, transparent 9px) 0 0 / 18px 18px,
    linear-gradient(#101d18 9px, transparent 9px) 0 0 / 18px 18px,
    #fff;
  color: #101d18;
  font-weight: 950;
}

.qr-mark {
  width: 74px;
  height: 74px;
  font-size: 13px;
}

.lot-row {
  cursor: pointer;
}

.lot-row:hover {
  border-color: var(--green);
}

.lot-detail {
  display: grid;
  grid-gap: 14px;
  gap: 14px;
}

.lot-detail h2 {
  margin: 0;
}

.lot-qr {
  width: 100%; max-width: 180px;
  min-height: 180px;
  justify-self: center;
  padding: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.lot-actions {
  display: flex;
  flex-wrap: wrap;
  grid-gap: 10px;
  gap: 10px;
}

.waste-panel {
  display: grid;
  grid-template-columns: 1fr minmax(120px, .45fr) auto;
  align-items: end;
  grid-gap: 10px;
  gap: 10px;
  padding: 12px;
  border: 1px solid #f0b5b0;
  border-radius: 8px;
  background: #fff7f6;
}

.waste-panel[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(18, 52, 44, .58);
}

.modal-panel {
  width: 100%; max-width: 980px;
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(18, 52, 44, .68);
}

.sheet-panel {
  width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-gap: 10px;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sheet-thumbs {
  display: grid;
  align-content: start;
  grid-gap: 10px;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.sheet-thumb {
  display: grid;
  grid-gap: 6px;
  gap: 6px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f7faf8;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
}

.sheet-thumb.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.sheet-thumb img {
  width: 100%;
  object-fit: contain;
  object-position: top left;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: white;
}

.sheet-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-gap: 8px;
  gap: 8px;
  overflow: hidden;
}

.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-gap: 12px;
  gap: 12px;
}

.sheet-toolbar h2 {
  margin-top: 4px;
  font-size: 22px;
}

.sheet-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sheet-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.sheet-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 54px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
}

.sheet-arrow:first-of-type {
  left: 12px;
}

.sheet-arrow:last-of-type {
  right: 12px;
}

.integration-list div {
  grid-template-columns: auto 1fr auto;
}

.settings-tabs {
  display: flex;
  grid-gap: 8px;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
}

.settings-tab {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.settings-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--green-ink);
}

.settings-pane {
  display: none;
}

.settings-pane.active {
  display: block;
}

.sensor-settings-list {
  display: grid;
  grid-gap: 12px;
  gap: 12px;
}

.settings-zone-title {
  margin-top: 8px;
}

.sensor-setting {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 1fr) repeat(4, minmax(86px, 110px)) minmax(100px, auto);
  align-items: end;
  grid-gap: 12px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.sensor-setting input[type="number"] {
  min-height: 38px;
}

.sensor-setting input[type="text"] {
  min-height: 38px;
}

.api-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-gap: 12px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.api-summary strong,
.api-summary span {
  display: block;
}

.api-summary code {
  max-width: 420px;
  padding: 10px;
  border-radius: 8px;
  background: #102b24;
  color: #f8fff9;
  font-size: 12px;
  white-space: normal;
}

.toggle-line {
  display: flex;
  align-items: center;
  grid-gap: 8px;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
}

.toggle-line input {
  width: 20px;
  min-height: 20px;
}

.ok-text {
  color: var(--green-ink);
}

.warn-text {
  color: var(--amber);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  background: #102820;
  color: white;
  box-shadow: 0 18px 42px rgba(0,0,0,.18);
  font-weight: 800;
}

.toast.show {
  display: block;
}

@media (max-width: 800px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .brand {
    display: none;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    grid-gap: 8px;
    gap: 8px;
  }

  .nav-item {
    width: auto;
  }

  .main {
    padding: 18px;
  }

  .status-strip, .sensor-zone-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid, .forms-grid, .settings-grid {
    grid-template-columns: 1fr;
  }

  .sensor-setting {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .module-card, .product-choice-card {
    -webkit-flex: 0 0 calc(33.333% - 16px);
    flex: 0 0 calc(33.333% - 16px);
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .primary-button, .secondary-button, .danger-button {
    flex: 1;
  }

  .status-strip, .sensor-zone-grid {
    grid-template-columns: 1fr;
  }

  .role-panel h1 {
    font-size: 32px;
  }

  .role-card {
    -webkit-flex: 0 0 calc(50% - 18px);
    flex: 0 0 calc(50% - 18px);
    min-height: 170px;
  }

  .module-card, .product-choice-card {
    -webkit-flex: 0 0 calc(50% - 16px);
    flex: 0 0 calc(50% - 16px);
    min-height: 150px;
  }

  .sensor-setting {
    grid-template-columns: 1fr;
  }

  .cleaning-subtask {
    grid-template-columns: 1fr;
  }

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

  .sheet-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sheet-thumbs {
    grid-auto-flow: column;
    grid-auto-columns: 130px;
    overflow-x: auto;
  }
}


/* ── Product detail / pms-sub-header ─────────────────────────────────── */
.pms-sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.pms-sub-header h2 {
  margin: 0;
  flex: 1;
  font-size: 1.1rem;
}
.product-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
}
.product-tabs .ghost-button {
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 8px 18px;
  font-size: 0.9rem;
}
.product-tabs .ghost-button.active {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
