/* ═══════════════════════════════════════════════════════════
   MAPA — stock.css  |  mobile stock management view
   ═══════════════════════════════════════════════════════════ */

#view-stock {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}
#view-stock.hidden { display: none !important; }

/* Desktop: constrain to a centered column */
.st-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────── */
.st-hdr {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 50px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.st-hdr-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  flex: 1;
}

.st-hdr-user {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── KPI strip ────────────────────────────────────────────── */
.st-kpis {
  display: flex;
  align-items: stretch;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.st-kpi {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
}

.st-kpi-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.st-kpi-val.st-alarm { color: var(--red2); }

.st-kpi-lbl {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-top: 3px;
  text-align: center;
}

.st-kpi-div {
  width: 1px;
  background: var(--border);
  margin: 8px 0;
  flex-shrink: 0;
}

/* ── Action bar ───────────────────────────────────────────── */
.st-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Scrollable body ──────────────────────────────────────── */
.st-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px);
}

/* ── Section label ────────────────────────────────────────── */
.st-cat-hdr {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 14px 5px;
}

/* ── Material card ────────────────────────────────────────── */
.st-mat-card {
  margin: 0 10px 6px;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 60ms;
}
.st-mat-card:active  { background: var(--bg3); }
.st-mat-kritik       { border-color: rgba(220,38,38,0.35); }
.st-mat-uyari        { border-color: rgba(245,158,11,0.35); }

.st-mat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.st-mat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.st-mat-code {
  font-size: 10px;
  font-weight: 700;
  font-family: "DM Mono", monospace;
  letter-spacing: 0.03em;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  flex-shrink: 0;
  white-space: nowrap;
}

.st-mat-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-mat-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-sm);
}
.st-badge-ok     { background: rgba(16,185,129,0.12); color: var(--green2); border: 1px solid rgba(16,185,129,0.2); }
.st-badge-uyari  { background: rgba(245,158,11,0.12); color: var(--amber2); border: 1px solid rgba(245,158,11,0.2); }
.st-badge-kritik { background: rgba(220,38,38,0.12);  color: var(--red2);   border: 1px solid rgba(220,38,38,0.2);  }

.st-mat-bar-wrap {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.st-mat-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.st-bar-ok     { background: var(--green2); }
.st-bar-uyari  { background: var(--amber2); }
.st-bar-kritik { background: var(--red2); }

.st-mat-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.st-mat-qty {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.st-mat-min {
  font-size: 10px;
  color: var(--text3);
  font-family: "DM Mono", monospace;
}

/* ── Movements feed ───────────────────────────────────────── */
.st-mov-hdr {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 14px 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.st-mov-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.st-mov-sign {
  font-size: 16px;
  font-weight: 800;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  font-family: "DM Mono", monospace;
}
.st-sign-green { color: var(--green2); }
.st-sign-red   { color: var(--red2);   }
.st-sign-amber { color: var(--amber2); }

.st-mov-info {
  flex: 1;
  min-width: 0;
}

.st-mov-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-mov-note {
  display: block;
  font-size: 10px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-mov-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.st-mov-qty {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: "DM Mono", monospace;
}

.st-mov-time {
  font-size: 10px;
  color: var(--text3);
  font-family: "DM Mono", monospace;
}

.st-mov-empty, .st-loading {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
}

/* ── Movement entry modal ─────────────────────────────────── */
.st-mvtype-strip {
  display: flex;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 14px;
}

.st-mvtype-btn {
  flex: 1;
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text3);
  font-family: inherit;
  text-align: center;
  transition: background var(--dur), color var(--dur);
  -webkit-tap-highlight-color: transparent;
}
.st-mvtype-btn.active { background: var(--blue); color: #fff; }
.st-mvtype-btn.active.out-btn  { background: var(--red2); }
.st-mvtype-btn.active.adj-btn  { background: var(--amber2); }

.st-np-hint {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-bottom: 8px;
  min-height: 16px;
}

.st-np-display {
  font-size: 38px;
  font-weight: 800;
  color: var(--text);
  font-family: "DM Mono", monospace;
  text-align: center;
  padding: 10px 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 2px;
}

.st-np-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.st-np-key {
  aspect-ratio: 1.5 / 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 19px;
  font-weight: 700;
  font-family: "DM Mono", monospace;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 60ms, transform 60ms;
}
.st-np-key:active { transform: scale(0.93); background: var(--border2); }

.st-note-inp {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 14px;
  outline: none;
  box-sizing: border-box;
}
.st-note-inp:focus { border-color: var(--blue); }
.st-note-inp::placeholder { color: var(--text3); }

/* ── Production modal ─────────────────────────────────────── */
.st-prod-card {
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 60ms;
}
.st-prod-card:active { background: var(--bg3); }

.st-prod-mat {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.st-prod-info {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
  font-family: "DM Mono", monospace;
}

.st-prod-detail-hdr { margin-bottom: 12px; }

.st-back-btn {
  background: none;
  border: none;
  color: var(--blue2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 12px;
  font-family: inherit;
  display: block;
}

.st-cons-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.st-cons-list { display: flex; flex-direction: column; gap: 6px; }

.st-cons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.st-cons-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.st-cons-qty {
  font-size: 13px;
  font-weight: 700;
  color: var(--red2);
  font-family: "DM Mono", monospace;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 360px) {
  .st-kpi-val { font-size: 15px; }
  .st-mat-qty { font-size: 14px; }
}
