:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --available: #16a34a;
  --borrowed: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
}

.nav a:hover, .nav a.active {
  background: #eef2ff;
  color: var(--primary-dark);
}

.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.15rem; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.warning { background: #fef3c7; color: #92400e; }

label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 0.9rem; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  margin-top: 14px;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.secondary:hover { background: #d1d5db; }
.btn.danger { background: var(--error); }
.btn.danger:hover { background: #b91c1c; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.available { background: #dcfce7; color: var(--available); }
.badge.borrowed { background: #fee2e2; color: var(--borrowed); }

.scan-box {
  text-align: center;
  padding: 32px 16px;
}
.scan-box input[type=text] {
  font-size: 1.3rem;
  text-align: center;
  padding: 16px;
  max-width: 420px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); }
.stat .lbl { color: var(--muted); font-size: 0.85rem; }

.equipment-box {
  text-align: center;
  padding: 12px;
}
.equipment-box .name { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.equipment-box .code { color: var(--muted); font-family: monospace; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 640px;
}
.login-card .system-name {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.login-card h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.5rem;
  margin-top: 0;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 0; }
.checkbox-row input { width: auto; }

.search-input { margin-bottom: 10px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
