:root {
  --navy: #0b2a5b;
  --navy-2: #123b78;
  --ink: #152033;
  --muted: #647188;
  --line: #dbe3ee;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --gold: #d9a027;
  --gold-dark: #9f6e10;
  --green: #0f7b62;
  --red: #b42335;
  --shadow: 0 18px 38px rgba(21, 32, 51, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef3f9 0%, #f8fafc 42%, #eef2f6 100%);
}

button,
input {
  font: inherit;
}

button {
  min-height: 46px;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--soft);
  box-shadow: 0 0 0 1px rgba(11, 42, 91, 0.06);
}

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

.login-view {
  min-height: 100vh;
  padding: 32px 22px;
  display: grid;
  align-content: center;
  gap: 26px;
}

.brand-lockup,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup img,
.topbar-brand img {
  width: 54px;
  height: 34px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 8px 20px rgba(11, 42, 91, 0.08);
}

.brand-lockup p,
.brand-lockup h1 {
  margin: 0;
}

.brand-lockup p {
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-lockup h1 {
  font-size: 2rem;
  line-height: 1.05;
  color: var(--navy);
  letter-spacing: 0;
}

.login-panel,
.modal form {
  display: grid;
  gap: 14px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(18, 59, 120, 0.14);
}

.primary-button,
.warning-button,
.scan-button,
.search-box button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: var(--navy);
}

.warning-button {
  color: #1f1400;
  background: var(--gold);
}

.button-icon {
  font-size: 1.15rem;
}

.form-message,
.status-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-message.is-error,
.status-message.is-error {
  color: var(--red);
}

.form-message.is-ok,
.status-message.is-ok {
  color: var(--green);
}

.main-view {
  min-height: 100vh;
  padding-bottom: 86px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-brand strong {
  display: block;
  color: var(--navy);
  line-height: 1.1;
}

.topbar-brand span {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eaf1fb;
  color: var(--navy-2);
  font-size: 0.74rem;
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 1.3rem;
  line-height: 1;
}

.search-band {
  padding: 14px 16px 10px;
  display: grid;
  gap: 10px;
}

.search-box {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 22px rgba(21, 32, 51, 0.06);
}

.search-box input {
  border: 0;
  min-height: 42px;
  padding: 0;
  box-shadow: none;
}

.search-box button {
  min-height: 42px;
  padding: 0 14px;
  color: #fff;
  background: var(--navy);
}

.search-icon {
  text-align: center;
  color: var(--muted);
  font-size: 1.2rem;
}

.scan-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  color: #fff;
  background: var(--navy-2);
}

.scan-mark {
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 4px;
}

.content-area {
  padding: 8px 16px 20px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 42px 18px;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.3rem;
}

.empty-state p {
  margin: 0;
  line-height: 1.45;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  font-size: 1.8rem;
}

.product-card {
  display: grid;
  gap: 12px;
}

.product-head {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.product-head h2 {
  margin: 6px 0 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.primary-stock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(104px, 30vw, 128px);
  gap: 14px;
  align-items: center;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  padding: 18px 16px 18px 18px;
  box-shadow: var(--shadow);
}

.primary-stock-copy {
  min-width: 0;
}

.primary-stock small {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.stock-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}

.stock-number strong {
  font-size: 4rem;
  line-height: 0.95;
  letter-spacing: 0;
}

.stock-number span {
  color: rgba(255, 255, 255, 0.78);
}

.product-photo {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  background: #fff;
}

.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-photo.is-empty {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.1);
}

.product-photo.is-empty span {
  padding: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.location-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.location-row small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 3px;
}

.location-row strong {
  font-size: 1.6rem;
  color: var(--navy);
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-warehouses {
  display: grid;
  gap: 8px;
}

.secondary-warehouses h3 {
  margin: 4px 0;
  font-size: 0.95rem;
}

.warehouse-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.warehouse-row strong {
  color: var(--navy);
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.history-item strong {
  display: block;
}

.history-item small {
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 12;
  width: min(100%, 480px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.nav-item span {
  font-size: 1.15rem;
}

.nav-item.is-active {
  background: #eaf1fb;
  color: var(--navy);
}

.modal {
  width: min(92vw, 420px);
  border: 0;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(5, 17, 35, 0.5);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.scanner-modal {
  padding: 14px;
}

.scanner-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1.25;
  border-radius: 8px;
  background: #08162c;
}

.scanner-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(217, 160, 39, 0.85);
}

.current-stock-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 12px;
  border-radius: 8px;
  background: #eef3f8;
}

.current-stock-line span {
  color: var(--muted);
  font-weight: 800;
}

.current-stock-line strong {
  font-size: 2rem;
  color: var(--navy);
}

@media (max-width: 360px) {
  .primary-stock {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
    padding: 16px 14px;
  }

  .stock-number strong {
    font-size: 3.4rem;
  }

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

  .search-box {
    grid-template-columns: 28px 1fr;
  }

  .search-box button {
    grid-column: 1 / -1;
  }
}
