* { box-sizing: border-box; }
html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: #f5f7fb;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: #111827;
  color: #fff;
}

.sidebar-brand { padding: 20px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-title { font-size: 18px; font-weight: 700; }
.sidebar-user { padding: 10px 16px; color: #cbd5e1; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,.12); line-height: 1.5; }
.sidebar-nav { padding: 8px 0; }
.sidebar-link { display: block; padding: 12px 16px; color: #cbd5e1; text-decoration: none; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.is-active { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }

.app-content {
  flex: 1;
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
}

.page-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header { flex: 0 0 auto; }
.page-header h1 { margin: 0 0 12px; font-size: 22px; }

.page-frame,
.app-frame {
  display: block;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  border: 0;
  background: #fff;
  flex: 1;
}

.page-section .app-frame,
.page-section .page-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: auto;
  border: 0;
}

.app-frame {
  border-radius: 8px;
}

.app-frame.is-loading {
  visibility: hidden;
}

.app-content.is-frame-content {
  padding: 0;
}

.app-content.is-frame-content .page-frame,
.app-content.is-frame-content .app-frame {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
}

.shell-embedded-root,
.shell-embedded-root body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #fff;
}

.shell-embedded-root body {
  overflow: auto;
}

.shell-embedded-root #sidebarHost {
  display: none !important;
}

.shell-embedded-root main {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
}

.page-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

.shell-embedded-root .page-main {
  max-width: none;
  margin: 0;
}

.page-main h1 {
  margin: 0 0 16px;
  font-size: 24px;
}

.page-main table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.page-main th,
.page-main td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.page-main th {
  background: #f9fafb;
  font-weight: 700;
}

.inspection-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid #d8dde3;
  background: #f8fafc;
  border-radius: 6px;
  box-sizing: border-box;
}

.inspection-action-status {
  display: flex;
  align-items: center;
  min-width: 0;
}

.inspection-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.secondary-action {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #64748b;
  background: #fff;
  color: #334155;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.danger-action {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #dc2626;
  background: #fff;
  color: #b91c1c;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.secondary-action:disabled,
.danger-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.inspection-input-bar {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.3fr) 140px;
  gap: 10px;
  align-items: center;
  border: 1px solid #d8dde3;
  padding: 10px;
  background: #fff;
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.inspection-input-bar .input-group {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  box-sizing: border-box;
}

.inspection-input-bar .qty-group {
  grid-template-columns: auto 64px;
}

.inspection-input-bar label {
  white-space: nowrap;
  font-size: 12px;
  color: #6b7280;
}

.inspection-input-bar input {
  width: 100%;
  min-width: 0;
  height: 38px;
  box-sizing: border-box;
  font-size: 18px;
}

.inspection-input-bar button {
  white-space: nowrap;
}

.inspection-input-bar .readonly-value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 18px;
}

.inspection-input-bar .qty-group input {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
}

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

  .inspection-action-buttons {
    width: 100%;
  }

  .inspection-action-buttons button {
    flex: 1 1 auto;
  }

  .inspection-input-bar {
    grid-template-columns: 1fr;
  }

  .inspection-input-bar .input-group,
  .inspection-input-bar .qty-group {
    grid-template-columns: 1fr;
  }

  .inspection-input-bar input,
  .inspection-input-bar button {
    width: 100%;
  }

  .inspection-input-bar .qty-group input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

@media (min-width: 641px) {
  .inspection-input-bar #scanSubmitButton,
  .inspection-input-bar #loadPickingButton {
    width: auto;
  }

  .inspection-input-bar #pickingNoInput,
  .inspection-input-bar #scanCodeInput {
    width: 100%;
  }

  .inspection-input-bar #scanQtyInput {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
  }
}
