* {
  box-sizing: border-box;
}
:root {
  --green: #138a4b;
  --green2: #eaf6ef;
  --green3: #f2faf5;
  --blue: #2d7bd8;
  --purple: #6f42d9;
  --orange: #f59e0b;
  --red: #df3d3d;
  --text: #17212f;
  --muted: #75808b;
  --line: #e6ebef;
  --bg: #f7f9fb;
  --card: #fff;
  --sidebar: #fff;
}
body {
  margin: 0;
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select {
  font: inherit;
}
.hidden {
  display: none !important;
}
.shell {
  display: grid;
  grid-template-columns: 255px 1fr;
  min-height: 100vh;
}
aside {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 26px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  /* Menü ekrana sığmazsa kendi içinde kaysın; alttaki sekmeler kesilmesin. */
  overflow-y: auto;
  overscroll-behavior: contain;
}
.brand {
  padding: 0 10px 26px;
  text-align: center;
}
.brand-logo {
  display: block;
  width: 145px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}
.brand span {
  display: block;
  font-size: 14px;
  color: var(--green);
  font-weight: 700;
  margin-top: 12px;
}
.menu {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}
.menu button {
  border: 0;
  background: transparent;
  color: #253340;
  text-align: left;
  padding: 13px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.menu button.active,
.menu button:hover {
  background: #edf7f1;
  color: var(--green);
}
.menu i {
  font-style: normal;
  display: inline-block;
  width: 29px;
  color: var(--green);
}
.logout-side {
  width: 100%;
  margin-top: 20px;
}
main {
  padding: 26px 30px 38px;
  min-width: 0;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 14px;
}
.top h1 {
  margin: 0;
  font-size: 25px;
}
.top p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.user-box {
  display: flex;
  align-items: center;
  gap: 9px;
}
.status {
  background: #edf7f1;
  color: var(--green);
  font-weight: 800;
  padding: 9px 12px;
  border-radius: 18px;
  font-size: 12px;
}
.user-name {
  font-size: 13px;
  font-weight: 800;
  color: #314139;
}
.logout-btn {
  border: 1px solid #dce5df;
  background: #fff;
  color: #56645d;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.page {
  display: none;
}
.page.active {
  display: block;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 3px 14px rgba(25, 40, 55, 0.04);
}
.stat small {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.stat strong {
  display: block;
  font-size: 24px;
  margin-top: 7px;
}
.stat:nth-child(1) strong {
  color: var(--green);
}
.stat:nth-child(2) strong {
  color: var(--blue);
}
.stat:nth-child(3) strong {
  color: var(--purple);
}
.stat:nth-child(4) strong {
  color: var(--orange);
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 16px rgba(18, 32, 43, 0.04);
  overflow: hidden;
  margin-bottom: 18px;
}
.card-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head h2 {
  margin: 0;
  font-size: 17px;
}
.badge {
  font-size: 11px;
  background: #edf7f1;
  color: var(--green);
  padding: 6px 9px;
  border-radius: 20px;
  font-weight: 800;
}
.work {
  display: grid;
  grid-template-columns: minmax(620px, 1.45fr) minmax(330px, 0.75fr);
  gap: 18px;
}
.table-wrap {
  overflow: auto;
  max-height: 62vh;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th {
  position: sticky;
  top: 0;
  background: #fbfcfd;
  color: #65727c;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px 13px;
  border-bottom: 1px solid #edf1f3;
}
th.num,
td.num {
  text-align: right;
}
.scan {
  width: 100%;
  border: 1px solid #dbe2e6;
  border-radius: 8px;
  padding: 8px 9px;
  font:
    14px Consolas,
    monospace;
  background: #fff;
}
.scan:focus {
  outline: 2px solid #b7dec9;
  border-color: #84c19f;
}
.ok {
  background: #f6fbf8;
}
.bad {
  background: #fff4f4;
}
.actions {
  display: flex;
  gap: 9px;
  padding: 15px 18px;
}
.btn {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}
.btn.green {
  background: var(--green);
  color: #fff;
}
.btn.red {
  background: var(--red);
  color: #fff;
}
.btn.light {
  background: #eef2f4;
  color: #34454f;
}
.btn.camera {
  background: #e9f5ff;
  color: #1d6fa5;
}
.empty {
  padding: 36px 20px;
  text-align: center;
  color: #8b969f;
}
.summary-total {
  padding: 14px 17px;
  background: #f8faf9;
  border-top: 1px solid var(--line);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
}
.stock-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  min-width: 250px;
  background: #fff;
}
.form {
  padding: 24px;
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 7px;
}
.field input,
.field select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  background: #fff;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
}
.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: #18252e;
  color: #fff;
  padding: 13px 17px;
  border-radius: 10px;
  display: none;
  box-shadow: 0 8px 30px #0003;
  z-index: 50000;
}
.scan-row {
  display: grid;
  grid-template-columns: 48px minmax(180px, 1fr) minmax(180px, 1fr) 110px;
  gap: 8px;
  align-items: center;
  padding: 5px 12px;
}
.scan-row + .scan-row {
  border-top: 1px solid #f0f2f3;
}
.scan-row.scan-hidden {
  display: none;
}
.scan-num {
  font-size: 12px;
  color: #89949c;
  text-align: center;
}
.scan-product {
  font-weight: 700;
  font-size: 12px;
}
.scan-kg {
  text-align: right;
  font-weight: 800;
}
.summary-table {
  max-height: 55vh;
  overflow: auto;
}
#stok .form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 1fr 170px 170px;
  gap: 14px;
  align-items: end;
  max-width: none;
}
#stok .form .field {
  margin: 0;
}
#stok .form .btn {
  height: 43px;
}
.depo-topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.depo-search-wrap {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.depo-result {
  font-size: 13px;
  color: var(--green);
  font-weight: 800;
  min-height: 18px;
}
.depo-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(330px, 1fr));
  gap: 20px;
  align-items: start;
}
.depo-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(18, 32, 43, 0.05);
}
.depo-card-head {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.depo-card-head h3 {
  margin: 0;
  font-size: 16px;
}
.depo-card-head span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}
.depo-room {
  position: relative;
  background: #dad7cf;
  border: 10px solid #2d3439;
  padding: 18px 14px 16px;
  min-height: 440px;
  overflow: hidden;
}
.depo-room:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.depo-door {
  position: absolute;
  right: -10px;
  top: 43%;
  width: 22px;
  height: 86px;
  background: #90989c;
  border: 3px solid #30363a;
  z-index: 1;
}
.depo-forklift-area {
  position: absolute;
  right: 12px;
  top: 20px;
  bottom: 20px;
  width: 58px;
  border-left: 2px dashed #d4ad24;
  color: #786516;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  opacity: 0.7;
}
.pallet-plan {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 12px 10px;
  padding-right: 63px;
}
.pallet-box {
  position: relative;
  min-height: 62px;
  background: repeating-linear-gradient(90deg, #be8d4e 0 7px, #d8ad70 7px 11px);
  border: 2px solid #8a5f2e;
  border-radius: 4px;
  box-shadow: 0 4px 7px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}
.pallet-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 12px rgba(0, 0, 0, 0.22);
}
.pallet-box.empty {
  filter: grayscale(0.15);
  opacity: 0.78;
}
.pallet-box .pnum {
  background: #fff;
  color: #111;
  font-weight: 900;
  font-size: 15px;
  padding: 5px 7px;
  border-radius: 2px;
  box-shadow: 0 1px 3px #0002;
}
.pallet-box .dot {
  position: absolute;
  right: 5px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #32a35d;
  border: 1px solid #fff;
  display: none;
}
.pallet-box.filled .dot {
  display: block;
}
.pallet-box.search-hit {
  animation: palletBlink 0.75s ease-in-out infinite alternate;
  outline: 4px solid #ffd400;
  z-index: 5;
}
@keyframes palletBlink {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.55);
    box-shadow:
      0 0 0 5px rgba(255, 212, 0, 0.35),
      0 6px 14px rgba(0, 0, 0, 0.25);
  }
}
.modal {
  position: fixed;
  inset: 0;
  background: #07131ddd;
  display: grid;
  align-items: center;
  justify-items: center;
  z-index: 9999;
  padding: 18px;
}
.modal-card {
  width: min(580px, 100%);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  max-height: 88vh;
}
.modal-top {
  padding: 15px 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.modal-body {
  padding: 16px;
  overflow: auto;
  max-height: 78vh;
}
.depo-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background:
    radial-gradient(circle at 18% 18%, rgba(19, 138, 75, 0.1), transparent 30%),
    radial-gradient(
      circle at 82% 78%,
      rgba(220, 45, 45, 0.08),
      transparent 32%
    ),
    linear-gradient(135deg, #f8fbf9, #f4f7f8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-screen.hidden {
  display: none;
}
.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid #e5ebe7;
  border-radius: 22px;
  padding: 34px 34px 30px;
  box-shadow: 0 22px 70px rgba(22, 45, 34, 0.12);
}
.login-logo {
  display: block;
  width: 145px;
  max-width: 58%;
  height: auto;
  margin: 0 auto 18px;
  object-fit: contain;
}
.login-title {
  text-align: center;
  margin: 0;
  font-size: 24px;
  color: #18252e;
}
.login-sub {
  text-align: center;
  color: #7a8680;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 25px;
}
.login-field {
  margin-bottom: 15px;
}
.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #34423a;
  margin-bottom: 7px;
}
.login-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #dce5df;
  border-radius: 11px;
  background: #fbfdfc;
  overflow: hidden;
}
.login-icon {
  width: 42px;
  text-align: center;
  color: #168a4d;
  font-size: 16px;
}
.login-field input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 13px 13px 0;
  font-size: 15px;
  outline: none;
}
.login-btn {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #138a4b, #0f6f3d);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 8px 22px rgba(19, 138, 75, 0.2);
}
.login-error {
  min-height: 19px;
  color: #c73535;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin: 11px 0 0;
}
.login-foot {
  text-align: center;
  color: #9aa49f;
  font-size: 11px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid #eef2ef;
}
.camera-modal {
  position: fixed;
  inset: 0;
  background: #07131dee;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.camera-card {
  width: min(650px, 100%);
  background: #111;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 80px #0008;
}
.camera-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  color: #fff;
  background: #172129;
}
.camera-close {
  border: 1px solid #ffffff35;
  background: #ffffff15;
  color: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  font-weight: 800;
}
.camera-view {
  position: relative;
  background: #000;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.camera-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-frame {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 34%;
  height: 32%;
  border: 3px solid #39d475;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
}
.camera-line {
  position: absolute;
  left: 11%;
  right: 11%;
  top: 50%;
  height: 2px;
  background: #45f184;
  box-shadow: 0 0 13px #45f184;
}
.camera-status {
  padding: 14px 16px;
  background: #fff;
  text-align: center;
  color: #33433b;
  font-size: 13px;
  min-height: 46px;
}
@media (max-width: 1250px) {
  .depo-three {
    grid-template-columns: 1fr;
  }
  .depo-room {
    min-height: 520px;
  }
  .pallet-plan {
    gap: 16px 14px;
  }
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .work {
    grid-template-columns: 1fr;
  }
  #stok .form {
    grid-template-columns: 1fr 160px 1fr 150px 150px;
  }
}
@media (max-width: 800px) {
  .shell {
    /* minmax(0, …): uzun menü satırı sayfayı telefondan geniş yapmasın */
    grid-template-columns: minmax(0, 1fr);
  }
  aside {
    min-width: 0;
    height: auto;
    position: static;
    padding: 14px;
  }
  .brand {
    padding: 4px 8px 14px;
  }
  .brand-logo {
    width: 110px;
    height: auto;
  }
  .menu {
    display: flex;
    overflow: auto;
    margin-top: 8px;
  }
  .menu button {
    white-space: nowrap;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  main {
    padding: 16px;
  }
  .top {
    align-items: flex-start;
  }
  .status {
    display: none;
  }
  #stok .form {
    grid-template-columns: 1fr !important;
  }
  .scan-row {
    grid-template-columns: 32px 1fr;
  }
  .scan-product,
  .scan-kg {
    grid-column: 2;
  }
  .depo-room {
    padding: 12px 8px;
    min-height: 370px;
  }
  .pallet-plan {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(6, 1fr);
    padding-right: 45px;
    gap: 8px;
  }
  .depo-forklift-area {
    width: 42px;
  }
  .pallet-box {
    min-height: 48px;
  }
  .pallet-box .pnum {
    font-size: 12px;
  }
  .actions {
    flex-wrap: wrap;
  }
  .btn.camera {
    padding: 9px 11px;
    font-size: 12px;
  }
  .card-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

.scan-row.dup {
  background: #fff8e1;
}
.scan-dup {
  font-size: 12px;
  font-weight: 700;
  color: #9a6500;
  margin-top: 2px;
}
.toast {
  cursor: pointer;
}
/* Mevcut Stok: koli bilgisi gösterilmiyor */
#stok .stats .stat:nth-child(3),
#stok .table-wrap table th:nth-child(3),
#stok .table-wrap table td:nth-child(3) {
  display: none;
}
/* Hareket geçmişi: iptal edilen kayıtlar */
tr.row-cancelled td {
  color: #98a3ad;
}
tr.row-cancelled td b {
  text-decoration: line-through;
}
.badge.badge-cancel {
  background: #fdecec;
  color: #c0392b;
}
.hist-cancel {
  padding: 7px 10px;
  font-size: 11px;
  white-space: nowrap;
}
/* Kısa ekranlı bilgisayarlarda menüyü sıkılaştır ki kaydırmadan sığsın. */
@media (min-width: 801px) and (max-height: 900px) {
  aside {
    padding: 16px 14px;
  }
  .brand {
    padding-bottom: 12px;
  }
  .brand-logo {
    width: 104px;
  }
  .menu {
    margin-top: 8px;
    gap: 2px;
  }
  .menu button {
    padding: 9px 14px;
  }
  .logout-side {
    margin-top: 12px;
  }
}
