:root {
  --pink: #bf7892;
  --pink-soft: #e4bcc9;
  --green: #019190;
  --green-dark: #017e7d;
  --page: #d6e4e2;
  --page-deep: #c8d9d6;
  --panel-border: #a9c5c1;
  --ink: #111;
  --ink-soft: #39504e;
  --log-border: #4e6d6a;
}
*,
*::before,
*::after { box-sizing: border-box; }

html, body { min-height: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: linear-gradient(180deg, var(--page) 0%, #eef4f3 100%); color: var(--ink); }
.container { width: min(100%, 1920px); margin: 0 auto; padding: 18px 18px 16px; }
.card { background: rgba(255,255,255,0.92); border: 1px solid rgba(1,145,144,0.18); border-radius: 12px; padding: 16px; box-shadow: 0 8px 28px rgba(26,52,49,0.12); }
.card.small { max-width: 420px; margin: 40px auto; }
h1 { margin: 0 0 14px; }
h2 { margin: 0 0 10px; font-size: 24px; font-weight: 400; }
label { display: block; margin-bottom: 10px; font-size: 14px; }
input,
select,
textarea { width: 100%; padding: 10px; border: 1px solid #cfcfcf; border-radius: 6px; box-sizing: border-box; font: inherit; }
button, .btn { display: inline-block; border: 0; border-radius: 8px; padding: 10px 14px; background: var(--green); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { background: var(--green-dark); }
button:active, .btn:active { background: var(--pink); }
.button-row { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button-row .btn,
.button-row button { margin: 0; }
.meta-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.flash-stack { margin-bottom: 12px; }
.flash { padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.86); margin-bottom: 8px; border-left: 4px solid var(--panel-border); }
.flash.error { background: #ffe7e7; }
.flash.scan { background: #e7fff3; }
.flash.info { background: #eef4ff; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ddd; padding: 8px; }
th { background: #f4f4f4; text-align: left; }
.report-table {
  table-layout: fixed;
}

.report-table .col-qty {
  width: 10%;
}

.report-table .col-item {
  width: 38%;
}

.report-table .col-barcode {
  width: 52%;
}

.report-table .col-location {
  width: 24%;
}

.report-table .item-cell {
  overflow-wrap: anywhere;
}

.report-table .barcode-cell {
  word-break: normal;
  overflow-wrap: break-word;
}

.report-table .location-cell {
  overflow-wrap: anywhere;
}

.report-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -16px -16px 12px;
  padding: 16px 16px 12px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(1,145,144,0.16);
  border-radius: 12px 12px 0 0;
}

.report-button-row {
  margin-top: 0;
}

.report-bottom-row {
  padding-bottom: 8px;
}

.report-topbar h1 {
  margin: 12px 0 0;
}

.report-notes-section {
  margin-top: 20px;
  padding-top: 8px;
}

.report-notes-list {
  display: grid;
  gap: 10px;
}

.report-note-card {
  border: 1px solid rgba(1,145,144,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.82);
  padding: 12px 14px;
}

.report-note-item {
  font-weight: 700;
  margin-bottom: 6px;
}

.report-note-text {
  color: var(--ink-soft);
}
.hint { color: #555; font-size: 12px; }

.project-picker {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #cfd8d7;
  border-radius: 12px;
}

.project-picker legend {
  padding: 0 8px;
  font-weight: 700;
}

.project-option-list {
  display: grid;
  gap: 10px;
}

.project-option {
  display: block;
  margin: 0;
  cursor: pointer;
}

.project-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.project-option span {
  display: block;
  padding: 16px 18px;
  border: 2px solid #d7e2e0;
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.project-option strong {
  display: block;
  font-size: 17px;
}

.project-option:hover span {
  border-color: #9abfbb;
  background: #f7fbfb;
}

.project-option input[type="radio"]:checked + span {
  border-color: var(--green);
  background: rgba(1,145,144,0.12);
  box-shadow: inset 0 0 0 1px rgba(1,145,144,0.16);
}

.project-option input[type="radio"]:focus-visible + span {
  outline: 3px solid rgba(1,145,144,0.24);
  outline-offset: 2px;
}

.desktop-shell {
  min-height: calc(100vh - 34px);
}

.desktop-topline {
  display: grid;
  gap: 12px;
  font-size: 15px;
  margin-bottom: 18px;
}

.desktop-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.desktop-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 0 2px;
}

.status-label {
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

.status-chip a {
  color: #0a60c8;
}

.desktop-view-select {
  justify-self: end;
  width: min(100%, 190px);
}

.desktop-view-select select,
.log-panel-corner select {
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  color: var(--ink-soft);
}

.scan-form {
  margin-bottom: 14px;
}

.scan-form label {
  display: block;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.scan-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.scan-form input {
  border: 1px solid #5da5a4;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 18px;
  background: rgba(255,255,255,0.96);
}

.scan-subline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 0 4px;
  min-height: 20px;
}

.mode-toggle {
  margin: 0;
}

.mode-pill {
  min-width: 124px;
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.74);
  color: var(--ink-soft);
  border: 1px solid rgba(1,145,144,0.18);
  font-size: 15px;
  font-weight: 700;
}

.mode-pill:hover {
  background: rgba(255,255,255,0.9);
}

.mode-pill.active {
  background: linear-gradient(135deg, #16a3a5 0%, #018a88 100%);
  color: #f4f4f4;
}

.desktop-top-btn,
.desktop-inline-btn {
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

.project-chip {
  min-width: 220px;
}

.greeting-chip {
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
}

.offline-chip {
  justify-self: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: #b32020;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.offline-chip[hidden] {
  display: none !important;
}

.camera-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #16a3a5 0%, #018a88 100%);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(1, 138, 136, 0.18);
}

.camera-icon-svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  display: block;
}

.camera-icon-btn:hover {
  background: linear-gradient(135deg, #0f9797 0%, #037b7f 100%);
}

.camera-icon-btn:active {
  background: linear-gradient(135deg, #c98ea5 0%, #b86d8c 100%);
}

.dashboard-actions {
  margin-top: 18px;
}

.desktop-button-grid {
  display: grid;
  gap: 10px;
  border: 0;
  padding: 0;
  align-items: stretch;
}

.desktop-button-grid.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.desktop-button-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.desktop-button-grid.five-up {
  grid-template-columns: 1.1fr 1fr 0.9fr 1.1fr 0.9fr;
}

.desktop-button-grid form {
  margin: 0;
  display: block;
  width: 100%;
}

.span-two-mobile {
  grid-column: auto;
}

.desktop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  border-radius: 999px;
  border: 0;
  padding: 10px 16px;
  background: linear-gradient(135deg, #16a3a5 0%, #018a88 100%);
  color: #f4f4f4;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
  letter-spacing: 0.02em;
}

a.desktop-btn,
a.desktop-btn:visited {
  color: #f4f4f4;
}

.desktop-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #0f9797 0%, #037b7f 100%);
}

.desktop-btn:active:not(:disabled) {
  background: linear-gradient(135deg, #c98ea5 0%, #b86d8c 100%);
}

.desktop-btn:disabled,
.desktop-btn.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.log-panel {
  margin: 20px 0 14px;
  position: relative;
}

.log-surface {
  min-height: 540px;
  max-height: 540px;
  overflow-y: auto;
  background: rgba(255,255,255,0.74);
  border: 2px solid var(--log-border);
  border-radius: 20px;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

.log-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  padding: 10px 18px;
  margin: 0;
  border-bottom: 1px solid rgba(78,109,106,0.12);
}

.log-line:last-child {
  border-bottom: 0;
}

.log-timestamp {
  display: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.log-message {
  white-space: pre-wrap;
}

.desktop-shell[data-view-mode="detailed"] .log-timestamp {
  display: inline;
}

.desktop-shell[data-view-mode="detailed"] .log-line {
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
}

.log-panel-corner {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: min(190px, calc(100% - 28px));
}

.log-error {
  color: #7a1111;
}

.desktop-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.desktop-footer-actions .desktop-btn {
  width: auto;
  min-width: 150px;
}

.desktop-utility-links {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.desktop-utility-links a {
  color: var(--green-dark);
  font-weight: 700;
}

.lookup-form {
  margin-bottom: 14px;
}

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

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

.scan-flash[hidden] {
  display: none;
}

.scan-flash {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
}

.scan-flash-scan,
.scan-flash-info {
  background: rgba(250, 255, 255, 0.92);
}

.scan-flash-error {
  background: rgba(255, 214, 214, 0.88);
}

.scan-flash-active {
  animation: shutter-flicker 180ms ease-out;
}

@keyframes shutter-flicker {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 0.98;
  }
  42% {
    opacity: 0.12;
  }
  68% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.voice-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.voice-modal-card {
  position: relative;
  z-index: 1;
  width: min(94vw, 960px);
  margin: 4vh auto 0;
  padding: 22px;
  border: 1px solid rgba(1,145,144,0.24);
  border-radius: 18px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 20px 50px rgba(10, 21, 20, 0.28);
  max-height: 90vh;
  overflow: auto;
}

.voice-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.voice-mode-pill {
  min-width: 110px;
}

.voice-source-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.voice-transcript-box {
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
  padding: 14px 16px;
  border: 2px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(247, 251, 251, 0.95);
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.45;
}

.voice-text-input {
  min-height: 160px;
  margin-top: 0;
}

.voice-status {
  min-height: 24px;
  margin: 12px 0 0;
  font-weight: 700;
  color: var(--green-dark);
}

.voice-upload-row {
  margin-top: 12px;
}

.voice-action-row,
.voice-review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.voice-review-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(1,145,144,0.18);
}

.voice-review-summary {
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

.voice-review-items {
  display: grid;
  gap: 12px;
}

.voice-review-card {
  padding: 14px;
  border: 1px solid #d7e2e0;
  border-radius: 14px;
  background: rgba(250, 252, 252, 0.96);
}

.report-modal-card {
  max-width: 520px;
}

.report-choice-pill {
  flex: 1 1 200px;
  text-align: center;
}

.voice-review-title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

.voice-review-copy {
  margin-bottom: 8px;
  color: var(--ink-soft);
}

.camera-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 21, 20, 0.6);
}

.camera-modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 760px);
  margin: 6vh auto 0;
  padding: 22px;
  border: 1px solid rgba(1,145,144,0.24);
  border-radius: 14px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 20px 50px rgba(10, 21, 20, 0.28);
}

.camera-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.camera-help {
  margin: 0 0 10px;
  color: var(--ink-soft);
}

.camera-status {
  min-height: 24px;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--green-dark);
}

.camera-scanner-shell {
  border: 3px solid var(--panel-border);
  background: #f6fbfa;
  padding: 12px;
  height: 260px;
  overflow: hidden;
}

#camera_scanner_view {
  width: 100%;
  height: 100%;
}

#camera_scanner_view > div {
  height: 100%;
}

#camera_scanner_view video {
  border-radius: 8px;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  object-position: center;
}

.camera-confirmation {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 700;
  color: var(--ink);
}

.camera-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.camera-action-btn {
  min-height: 50px;
}

.camera-close-btn {
  min-width: 120px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.inset-card {
  box-shadow: none;
  border: 1px solid #ddd;
}

.client-email-block {
  white-space: pre-wrap;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(1,145,144,0.18);
  border-radius: 12px;
  padding: 16px;
  font: inherit;
  line-height: 1.45;
}

.col-select {
  width: 180px;
}

.bulk-select-cell {
  vertical-align: top;
}

.barcode-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.barcode-check:last-child {
  margin-bottom: 0;
}

.inventory-bulk-actions {
  margin-bottom: 16px;
}

.inventory-header {
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 252, 252, 0.98);
  padding: 8px 0 10px;
  backdrop-filter: blur(6px);
}

.inventory-header h1 {
  margin: 0;
}

.inventory-header-actions {
  margin: 0;
}

.inventory-log-panel {
  margin: 0 0 18px;
}

.inventory-toolbar {
  top: 70px;
  z-index: 19;
  border-top: 1px solid rgba(1,145,144,0.12);
  padding-top: 12px;
}

.inventory-log-surface {
  min-height: 220px;
  max-height: 220px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #d9d9d9;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  background: #d7f2dd;
  color: #0b5e23;
}

.pill.bad {
  background: #ffd9d9;
  color: #8d1111;
}

.action-stack {
  display: grid;
  gap: 6px;
}

.action-stack form {
  margin: 0;
}

.action-stack button {
  width: 100%;
}

button.danger,
.btn.danger {
  background: #9c1f1f;
}

button.danger:hover,
.btn.danger:hover {
  background: #7d1717;
}

code {
  font-family: "Courier New", Courier, monospace;
}

@media (max-width: 1100px) {
  .desktop-header-row {
    align-items: center;
  }

  .desktop-view-select {
    justify-self: start;
  }

  .desktop-button-grid.four-up,
  .desktop-button-grid.three-up,
  .desktop-button-grid.five-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .desktop-control-row {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    align-items: center;
    justify-content: start;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 14px;
  }

  .desktop-topline {
    gap: 10px;
  }

  .desktop-header-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 8px;
  }

  .desktop-control-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
  }

  .mode-pill {
    min-width: 0;
    width: 100%;
    padding: 9px 10px;
    font-size: 13px;
  }

  .camera-icon-btn {
    width: 42px;
    height: 42px;
  }

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

  .desktop-inline-btn {
    padding: 10px 14px;
  }

  .greeting-chip {
    align-self: start;
    justify-self: end;
    font-size: 13px;
  }

  .desktop-button-grid.four-up,
  .desktop-button-grid.three-up,
  .desktop-button-grid.five-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .log-panel-corner {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

  .admin-header {
    flex-direction: column;
  }

  .desktop-view-select {
    width: 100%;
    justify-self: stretch;
  }

  .desktop-footer-actions {
    flex-direction: column;
  }

  .desktop-footer-actions .desktop-btn {
    width: 100%;
    min-width: 0;
  }

  .camera-action-row {
    grid-template-columns: 1fr;
  }

  .log-surface {
    min-height: 320px;
    max-height: 420px;
    font-size: 17px;
  }

  .log-line {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 12px;
  }

  .span-two-mobile {
    grid-column: span 2;
  }

  .report-table,
  .report-table thead,
  .report-table tbody,
  .report-table tr,
  .report-table th,
  .report-table td {
    display: block;
    width: 100%;
  }

  .report-table thead {
    display: none;
  }

  .report-table tr {
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: rgba(255,255,255,0.94);
    overflow: hidden;
  }

  .report-table td {
    border: 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .report-table td:last-child {
    border-bottom: 0;
  }

  .report-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-soft);
  }

  .report-table .bulk-select-cell {
    grid-template-columns: 1fr;
  }

  .report-table .bulk-select-cell::before {
    content: "Select";
  }

  .report-table .barcode-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }
}

@media print {
  .flash-stack,
  .button-row,
  .desktop-topline,
  .scan-form,
  .control-section,
  .desktop-footer-actions,
  .desktop-utility-links {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
  }

  .report-table .col-qty {
    width: 8%;
  }

  .report-table .col-item {
    width: 34%;
  }

  .report-table .col-barcode {
    width: 58%;
  }

  .report-table th,
  .report-table td {
    padding: 6px 8px;
    font-size: 11pt;
    vertical-align: top;
  }
}
