:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --pending: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* "100% 100%" (khong phai cover/contain) de anh luon phu kin dung khung
     man hinh, khong chua vien va khong cat mat goc trang tri - chap nhan
     hoi gian/keo nhe ty le vi day la anh nen trang tri, khong can chinh xac
     tuyet doi ve hinh dang. */
  background: var(--bg) url('training-bg.webp') center / 100% 100% no-repeat fixed;
  color: var(--text);
}

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

.container.wide {
  max-width: 1400px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 12px; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin: 0 0 20px; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin: 16px 0 6px;
}

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

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.employee-picklist {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  margin-top: 8px;
}
.employee-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  margin: 0;
  font-weight: 400;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}
.employee-item:hover { background: var(--bg); }
.employee-item input { width: 16px; height: 16px; flex: none; }
.employee-name { flex: 1; }
.employee-dept {
  color: var(--muted);
  font-size: 0.78rem;
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 8px;
}

button, .btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-block { width: 100%; margin-top: 24px; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

.toolbar { display: flex; justify-content: flex-end; margin: 16px 0 10px; }

.edit-cell { white-space: nowrap; display: flex; align-items: center; gap: 6px; }

.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.success-icon { font-size: 2.5rem; text-align: center; margin-bottom: 8px; }

.info-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.info-box div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.92rem; }
.info-box .label { color: var(--muted); }

nav.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}
nav.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
nav.topbar .brand-logo { height: 40px; width: auto; display: block; }

.page-header {
  display: flex;
  align-items: center;
  padding: 20px 16px 0;
}
.page-header .brand-logo { height: 56px; width: auto; display: block; }
nav.topbar a { color: var(--text); text-decoration: none; margin-left: 18px; font-size: 0.9rem; }
nav.topbar a.active { color: var(--primary); font-weight: 600; }

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

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.compact-input {
  width: 120px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.issue-btn { padding: 6px 12px; font-size: 0.85rem; }

.search-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 20px; }
.search-form .field { display: flex; flex-direction: column; }
.search-form label { margin: 0 0 4px; }
.search-form input, .search-form select { padding: 8px 10px; width: auto; }

.empty-state { color: var(--muted); text-align: center; padding: 30px 0; }

.permission-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.permission-item { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 0.88rem; margin: 0; }
.permission-item input { width: 15px; height: 15px; }

.permission-form .permission-list, .reset-form { margin: 0 0 8px; }
.reset-form { display: flex; gap: 6px; }
.reset-form input { padding: 6px 8px; width: auto; }

.card-code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.issued { background: #dcfce7; color: #166534; }
.badge.returned { background: #fee2e2; color: #991b1b; }
