/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
}

nav {
  background: #1a1a1a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-links a {
  color: #ccc;
  text-decoration: none;
  font-size: 13px;
  transition: color .15s;
}
.nav-links a:hover { color: #fff; }
.nav-location {
  background: #333;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: #aaa;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

h2 { font-size: 20px; font-weight: 600; margin-bottom: 20px; color: #111; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
h4 { font-size: 13px; font-weight: 600; margin: 12px 0 6px; }

.alert {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px 24px;
  min-width: 160px;
  text-align: center;
}
.stat-num   { font-size: 28px; font-weight: 700; color: #1a1a1a; }
.stat-label { font-size: 12px; color: #888; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 8px 10px;
  background: #f8f8f8;
  border-bottom: 2px solid #e0e0e0;
  font-weight: 600;
  white-space: nowrap;
}
td {
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tr:hover td { background: #fafafa; }
td.zero { color: #dc3545; font-weight: 600; }
tr.low td { background: #fff8f0; }

.btn-primary, .btn-secondary, .btn-small {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-primary   { background: #1a1a1a; color: #fff; }
.btn-secondary { background: #fff; color: #333; border: 1px solid #ccc; }
.btn-small     { background: #f0f0f0; color: #333; padding: 4px 10px; font-size: 12px; }
.btn-primary:hover, .btn-secondary:hover, .btn-small:hover { opacity: .8; }

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  margin-bottom: 14px;
}
input[type=text], input[type=number], input[type=password],
input[type=file], select, textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 13px;
  width: 100%;
  background: #fff;
}
input:focus, select:focus { outline: none; border-color: #1a1a1a; }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
hr { border: none; border-top: 1px solid #eee; margin: 16px 0; }
code {
  background: #f5f5f5;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: block;
  margin: 4px 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.search-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.search-form input, .search-form select {
  width: auto;
  flex: 1;
  min-width: 160px;
}
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

.scan-card { max-width: 480px; }
.barcode-input {
  font-size: 20px !important;
  padding: 12px !important;
  letter-spacing: 0.05em;
}
.scan-hint {
  margin-top: 14px;
  color: #888;
  font-size: 13px;
  line-height: 1.6;
}

.login-wrap {
  max-width: 360px;
  margin: 60px auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 36px 32px;
  text-align: center;
}
.login-wrap h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.4;
}
.login-wrap h1 span { font-weight: 300; font-size: 16px; }
.login-wrap label { text-align: left; }
.login-wrap button { width: 100%; margin-top: 6px; padding: 10px; font-size: 14px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 28px 28px 20px;
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  nav { padding: 0 12px; }
  .nav-links { gap: 12px; }
}
