* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Navbar --- */
nav {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand img {
  height: 40px;
  width: auto;
  display: block;
}
.brand .app-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}
nav .nav-links {
  margin-left: auto;
}
@media (max-width: 720px) {
  nav {
    justify-content: space-between;
  }
  .brand {
    flex-basis: 100%;
    justify-content: center;
    text-align: center;
  }
  nav .nav-links {
    margin-left: 0;
  }
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  text-decoration: none;
  color: #555;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: .9rem;
  transition: background .12s, color .12s;
}
.nav-links a:hover { background: #f0f2f5; color: #1a1a1a; }
.nav-links a.active {
  background: #2563eb;
  color: #fff;
}
#logout-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: .85rem;
  color: #555;
}
#logout-btn:hover { background: #e5e7eb; }

/* --- Container --- */
.container {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px;
  width: 100%;
  flex: 1;
}

/* --- Footer --- */
footer.app-footer {
  margin-top: 32px;
  padding: 16px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: .85rem;
  color: #666;
}
footer.app-footer img {
  height: 24px;
  width: auto;
  display: block;
}

/* --- Scrollable list --- */
.list-scroll {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.item-list {
  list-style: none;
}

.item-list li {
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s, opacity .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
}
.item-list li:last-child { border-bottom: none; }
.item-list li:hover { background: #eff6ff; }
.item-list li.selected { background: #dbeafe; }
.item-list li.dimmed { opacity: .4; }

/* --- Item fields --- */
.item-id {
  font-weight: 700;
  font-size: .95rem;
  min-width: 48px;
  color: #2563eb;
}
.item-name {
  flex: 1;
  margin: 0 12px;
  font-size: .9rem;
}
.item-code {
  font-size: .78rem;
  color: #888;
  font-family: monospace;
}
.item-sub {
  font-size: .75rem;
  color: #999;
  margin-top: 2px;
}

/* --- Search highlight --- */
mark {
  background: #fef08a;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* --- Search --- */
.search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: #2563eb; }

.result-info {
  font-size: .85rem;
  color: #666;
  margin-top: 6px;
  height: 20px;
}

/* --- Banner --- */
.banner {
  display: none;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: .95rem;
}
.banner .label { color: #555; font-size: .8rem; }
.banner .name  { font-weight: 600; margin-top: 2px; }
.banner .clear-btn {
  float: right;
  background: none;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  color: #2563eb;
  font-size: .8rem;
}
.banner .clear-btn:hover { background: #bfdbfe; }

/* --- Buttons --- */
.btn-primary {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.pagination button {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
  color: #333;
}
.pagination button:hover { background: #f0f2f5; }
.pagination button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.pagination .page-info {
  font-size: .85rem;
  color: #666;
}

/* --- Messages --- */
.msg { font-size: .85rem; margin-top: 8px; width: 100%; }
.msg.success { color: #16a34a; }
.msg.error   { color: #dc2626; }
