:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2933;
  background: #f5f7f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

.status-panel {
  width: min(100%, 1120px);
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #ffffff;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(31, 41, 51, 0.08);
}

.eyebrow {
  margin: 0 0 8px;
  color: #52616b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
}

.summary {
  max-width: 48rem;
  margin: 18px 0 28px;
  color: #52616b;
  font-size: 1.05rem;
  line-height: 1.6;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
}

.status-grid div {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
}

dt {
  color: #52616b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.auth-panel {
  margin-top: 28px;
  border-top: 1px solid #e5e7eb;
  padding-top: 24px;
}

.auth-copy h2,
.session-bar h2,
.user-form h3,
.section-header h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.auth-copy p,
.session-bar p,
.section-header p,
.loading-text,
.form-status {
  margin: 8px 0 0;
  color: #52616b;
  line-height: 1.5;
}

.form-status.success {
  color: #0f766e;
}

.form-status.error {
  color: #b42318;
}

.form-status.warning {
  color: #9a6700;
}

.compact-status {
  align-self: end;
  margin: 0;
  min-height: 42px;
  padding-top: 21px;
}

.notice {
  border-left: 3px solid #b42318;
  padding-left: 10px;
  color: #912018;
  font-weight: 650;
}

.primary-button,
.secondary-button,
.google-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  margin-top: 18px;
  border: 1px solid #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.secondary-button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1f2933;
}

.google-button {
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid #dadce0;
  background: #ffffff;
  color: #3c4043;
  font-family: Roboto, Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
}

.google-button:hover {
  border-color: #d2e3fc;
  background: #f8fbff;
}

.google-button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.google-button svg {
  width: 18px;
  height: 18px;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace {
  display: grid;
  gap: 24px;
}

.workspace-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.nav-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #52616b;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 4px;
}

.nav-tab.active {
  border-bottom-color: #0f766e;
  color: #0f766e;
}

.catalog-section {
  display: grid;
  gap: 16px;
}

.admin-section[hidden],
.catalog-section[hidden],
.inventory-panel[hidden],
.reports-section[hidden] {
  display: none;
}

.inventory-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.inventory-side-nav {
  display: grid;
  gap: 6px;
  position: sticky;
  top: 12px;
}

.side-tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #52616b;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 12px;
  text-align: left;
}

.side-tab.active {
  border-color: #b7ddd5;
  background: #e6f4f1;
  color: #0f766e;
}

.inventory-panels,
.inventory-panel {
  display: grid;
  gap: 16px;
}

.reports-section {
  display: grid;
  gap: 16px;
}

.report-subheader {
  margin-top: 16px;
}

.threshold-control {
  width: min(180px, 100%);
}

.history-section {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.catalog-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  align-items: end;
  gap: 12px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  gap: 10px;
}

.user-form,
.item-form,
.movement-form,
.transfer-form,
.count-form,
.location-form,
.register-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto;
  align-items: end;
  gap: 14px;
  margin-top: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.user-form h3,
.location-form h3,
.register-form h3,
.movement-form h3,
.transfer-form h3,
.count-form h3,
.user-form .form-status,
.location-form .form-status,
.register-form .form-status,
.item-form .form-status,
.movement-form .form-status,
.transfer-form .form-status,
.count-form .form-status {
  grid-column: 1 / -1;
}

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

.movement-form {
  grid-template-columns: minmax(180px, 1.4fr) minmax(160px, 0.8fr) minmax(120px, 0.6fr) minmax(220px, 1.6fr) auto;
}

.transfer-form {
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(110px, 0.5fr) minmax(220px, 1.4fr) auto;
}

.count-form {
  grid-template-columns: minmax(220px, 1.4fr) minmax(140px, 0.7fr) minmax(260px, 1.6fr) auto;
}

.location-form {
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) minmax(120px, 160px) auto;
}

.register-form {
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) minmax(220px, 1fr) minmax(220px, 1fr) auto;
}

.register-table-wrap {
  margin-top: 24px;
}

.item-form .form-actions {
  display: flex;
  gap: 10px;
}

.camera-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  min-height: auto;
  width: auto;
}

.wide-field {
  min-width: 0;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.iconless-button {
  min-width: 76px;
}

.barcode-scanner,
.picture-camera {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.barcode-scanner[hidden],
.picture-camera[hidden] {
  display: none;
}

.barcode-scanner video,
.picture-camera video {
  width: min(100%, 420px);
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #111827;
  object-fit: cover;
}

.scanner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #52616b;
  font-size: 0.86rem;
}

label {
  display: grid;
  gap: 6px;
  color: #52616b;
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  color: #1f2933;
  font: inherit;
}

input[type="file"] {
  padding: 9px 12px;
}

.picture-preview {
  display: grid;
  min-height: 78px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #697586;
  font-size: 0.82rem;
}

.picture-preview img {
  display: block;
  height: 78px;
  width: 100%;
  object-fit: cover;
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.items-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.items-table th,
.items-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: top;
}

.items-table th {
  position: sticky;
  top: 0;
  background: #ffffff;
  color: #52616b;
  font-size: 0.78rem;
  text-transform: uppercase;
  z-index: 1;
}

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

.history-table-wrap {
  max-height: 360px;
}

.history-table {
  min-width: 900px;
}

.report-table-wrap {
  max-height: 520px;
}

.report-table {
  min-width: 780px;
}

.movement-summary-table {
  min-width: 1120px;
}

.sales-report-table {
  min-width: 980px;
}

.reconciliation-report-table {
  min-width: 1050px;
}

.primary-cell,
.secondary-cell {
  display: block;
}

.primary-cell {
  font-weight: 750;
}

.secondary-cell {
  margin-top: 3px;
  color: #697586;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
}

.status-pill {
  display: inline-flex;
  min-width: 68px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.status-pill.active {
  background: #e6f4f1;
  color: #0f766e;
}

.status-pill.inactive {
  background: #f1f5f9;
  color: #52616b;
}

.row-button {
  min-height: 34px;
}

.positive-quantity {
  color: #0f766e;
  font-weight: 800;
}

.negative-quantity {
  color: #b42318;
  font-weight: 800;
}

.empty-cell {
  padding: 28px 12px;
  color: #697586;
  text-align: center;
}

code {
  font-size: 0.92em;
}

@media (max-width: 760px) {
  .status-panel {
    padding: 24px;
  }

  .session-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .section-header,
  .catalog-controls,
  .search-form,
  .inventory-layout,
  .item-form,
  .movement-form,
  .transfer-form,
  .count-form,
  .location-form,
  .register-form,
  .inline-control,
  .scanner-actions,
  .camera-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inventory-side-nav {
    position: static;
  }

  .scanner-actions,
  .camera-actions {
    display: grid;
  }
}
