:root {
  color-scheme: dark;
  --bg: #000;
  --panel: rgba(5, 12, 24, 0.92);
  --panel-soft: rgba(12, 24, 42, 0.86);
  --text: #f7f7f7;
  --muted: rgba(215, 225, 245, 0.62);
  --line: rgba(47, 134, 255, 0.28);
  --line-strong: rgba(57, 185, 255, 0.74);
  --accent: #2f86ff;
  --accent-2: #39b9ff;
  --danger: #ff6a6a;
  --ok: #68e6a1;
  --shadow: 0 0 28px rgba(47, 134, 255, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(9, 18, 34, 0.96), #000 42%),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(47, 134, 255, 0.44);
}

.icon-button {
  width: 56px;
  height: 56px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 38%),
    var(--panel);
  color: var(--accent-2);
  font-size: 27px;
  box-shadow: var(--shadow);
}

.product-family {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.product-family button {
  min-height: 40px;
  border: 2px solid rgba(47, 134, 255, 0.28);
  border-radius: 999px;
  padding: 0 13px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.01) 42%),
    rgba(5, 12, 24, 0.9);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 14px rgba(47, 134, 255, 0.08);
}

.product-family button.is-active {
  border-color: var(--line-strong);
  color: var(--accent-2);
  background: rgba(47, 134, 255, 0.14);
  box-shadow: 0 0 18px rgba(47, 134, 255, 0.26);
}

.login-panel {
  min-height: calc(100vh - 104px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 36%),
    var(--panel);
  box-shadow: var(--shadow);
}

.workspace.is-hidden,
.login-panel.is-hidden {
  display: none;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid rgba(47, 134, 255, 0.18);
  border-radius: 22px;
  background: rgba(5, 12, 24, 0.72);
  position: sticky;
  top: 8px;
  z-index: 5;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  min-width: 118px;
  min-height: 46px;
  border: 2px solid transparent;
  border-radius: 17px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.tab.is-active {
  border-color: var(--line-strong);
  background: rgba(47, 134, 255, 0.12);
  color: var(--accent-2);
  box-shadow: 0 0 18px rgba(47, 134, 255, 0.24);
}

.screen {
  display: none;
  padding-top: 16px;
}

.screen.is-active {
  display: block;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.segmented.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.segmented button,
.secondary-button {
  min-height: 50px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.01) 40%),
    rgba(5, 12, 24, 0.86);
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.segmented button.is-active {
  border-color: var(--line-strong);
  background: rgba(47, 134, 255, 0.14);
  color: var(--accent-2);
  box-shadow: 0 0 18px rgba(47, 134, 255, 0.26);
}

.segmented button:active,
.secondary-button:active,
.primary-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: rgba(247, 247, 247, 0.78);
  font-size: 13px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 54px;
  border: 2px solid rgba(47, 134, 255, 0.24);
  border-radius: 17px;
  background: rgba(5, 12, 24, 0.88);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  box-shadow: 0 0 0 1px rgba(127, 188, 255, 0.06) inset;
}

input:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow:
    0 0 0 1px rgba(127, 188, 255, 0.2) inset,
    0 0 18px rgba(47, 134, 255, 0.22);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
}

.field-grid,
.transfer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

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

.qty-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 54px;
  border: 2px solid rgba(47, 134, 255, 0.24);
  border-radius: 17px;
  overflow: hidden;
  background: rgba(5, 12, 24, 0.88);
  box-shadow: 0 0 0 1px rgba(127, 188, 255, 0.06) inset;
}

.qty-control:focus-within {
  border-color: var(--line-strong);
  box-shadow:
    0 0 0 1px rgba(127, 188, 255, 0.2) inset,
    0 0 18px rgba(47, 134, 255, 0.22);
}

.qty-control input {
  min-height: 54px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  box-shadow: none;
}

.quantity-row {
  display: grid;
  grid-template-columns: 0.9fr 1.05fr 1.05fr;
  gap: 10px;
}

.quantity-row .secondary-button {
  min-height: 62px;
  border-radius: 20px;
  font-size: 16px;
}

.quantity-action {
  color: var(--accent-2);
  font-size: 30px !important;
  line-height: 1;
}

.primary-button {
  position: relative;
  min-height: 58px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04) 34%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(180deg, rgba(30, 105, 210, 0.38), rgba(3, 7, 15, 0.96) 58%),
    var(--panel);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(127, 188, 255, 0.18) inset,
    0 0 18px rgba(47, 134, 255, 0.62),
    0 0 36px rgba(47, 134, 255, 0.2);
}

.primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(105, 182, 255, 0.22), transparent);
  transform: translateX(-120%);
  transition: transform 0.58s ease;
}

.primary-button:focus-visible::before,
.primary-button:hover::before {
  transform: translateX(120%);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
}

.pick-list {
  display: grid;
  gap: 8px;
  max-height: 326px;
  overflow: auto;
}

.pick-item,
.stock-item {
  width: 100%;
  border: 1px solid rgba(47, 134, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01) 38%),
    var(--panel-soft);
  color: var(--text);
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.pick-item {
  min-height: 58px;
  padding: 11px 12px;
}

.pick-item.is-selected {
  border-color: var(--line-strong);
  background: rgba(47, 134, 255, 0.14);
  box-shadow: 0 0 20px rgba(47, 134, 255, 0.22);
}

.product-name {
  display: block;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.2;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(247, 247, 247, 0.32);
  flex: 0 0 auto;
  margin-top: 1px;
}

.stock-list {
  display: grid;
  gap: 9px;
}

.stock-table {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(47, 134, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01) 38%),
    var(--panel-soft);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px 52px;
  gap: 7px;
  align-items: center;
  min-height: 54px;
  padding: 8px 9px;
  border-top: 1px solid rgba(47, 134, 255, 0.14);
}

.stock-row:first-child {
  border-top: 0;
}

.stock-head {
  min-height: 34px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  background: rgba(47, 134, 255, 0.08);
}

.stock-product {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.22;
}

.stock-product-name {
  min-width: 0;
}

.stock-color-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.stock-color-meta .color-dot {
  width: 10px;
  height: 10px;
  margin-top: 0;
}

.stock-row strong {
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 950;
  text-align: right;
}

.stock-item {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.stock-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stock-number {
  min-height: 62px;
  padding: 9px;
  border: 1px solid rgba(47, 134, 255, 0.18);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
}

.stock-number span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.stock-number strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.1;
  color: var(--accent-2);
}

.sticky-search {
  position: sticky;
  top: 72px;
  z-index: 4;
  padding-bottom: 10px;
  background: #000;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.form-message.is-error {
  color: var(--danger);
}

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

.history-panel {
  display: grid;
  gap: 8px;
  padding: 2px 0 6px;
}

.history-title {
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
}

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

.history-item,
.history-empty {
  margin: 0;
  min-height: 34px;
  border-left: 2px solid var(--accent-2);
  padding: 7px 9px;
  color: rgba(247, 247, 247, 0.78);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
  background: rgba(47, 134, 255, 0.08);
  border-radius: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-item span {
  min-width: 0;
}

.history-item strong {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 13px;
}

@media (min-width: 640px) {
  .app-shell {
    padding-inline: 24px;
  }

  .tab {
    min-width: 146px;
    font-size: 15px;
  }
}
