:root {
  --ink: #17233b;
  --muted: #718096;
  --line: #e7ecf3;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --navy: #142b4a;
  --blue: #3569d4;
  --blue-dark: #2857b7;
  --blue-soft: #edf3ff;
  --green: #16845b;
  --green-soft: #eaf7f1;
  --amber: #a96912;
  --amber-soft: #fff5e5;
  --red: #bd3b45;
  --red-soft: #fff0f1;
  --shadow: 0 12px 32px rgba(24, 43, 75, .07);
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.55;
}
button, input, select { font: inherit; }
a { color: inherit; }
nav {
  min-height: 70px; padding: 0 max(22px, calc((100% - 1180px) / 2));
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: #fff; background: var(--navy); box-shadow: 0 3px 14px rgba(15, 35, 65, .12);
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: 24px; font-weight: 750; letter-spacing: -.3px; font-size: 15px; white-space: nowrap; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, #5b8cf0, #3261c7); font-size: 17px;
  box-shadow: 0 5px 14px rgba(52, 105, 212, .32);
}
nav a { color: #cbd6e8; text-decoration: none; padding: 9px 12px; border-radius: 9px; font-weight: 550; transition: .18s ease; }
nav a:hover, nav a.active { color: #fff; background: rgba(255,255,255,.11); }
nav .sp { flex: 1; }
.nav-user { color: #d9e3f3; font-size: 12px; padding: 0 8px; }
.role-pill { display: inline-flex; align-items: center; border-radius: 30px; padding: 3px 9px; margin-left: 5px; color: #dbe8ff; background: rgba(103,151,239,.2); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .5px; }
#logout { color: #fff; border: 1px solid rgba(255,255,255,.2); }
main { width: min(1180px, calc(100% - 40px)); margin: 34px auto 64px; min-height: 65vh; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 23px; }
.eyebrow { color: var(--blue); text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; margin-bottom: 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(25px, 3vw, 34px); letter-spacing: -1.1px; line-height: 1.18; margin-bottom: 7px; }
h2 { font-size: 23px; letter-spacing: -.6px; margin-bottom: 5px; }
h3 { font-size: 15px; margin-bottom: 15px; }
.subtitle { color: var(--muted); margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; margin-bottom: 19px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 17px; }
.card-head h3 { margin: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.stat-card { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 21px; box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 17px; }
.stat-value { font-size: 30px; font-weight: 780; letter-spacing: -1px; margin: 13px 0 2px; }
.stat-note { color: var(--muted); font-size: 11px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.quick-link { display: flex; align-items: center; gap: 13px; text-decoration: none; padding: 16px; border: 1px solid var(--line); border-radius: 13px; transition: .18s ease; }
.quick-link:hover { border-color: #b9cdf7; background: #f8faff; transform: translateY(-2px); }
.quick-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); font-size: 18px; }
.quick-link strong { display: block; font-size: 13px; }
.quick-link small { display: block; color: var(--muted); margin-top: 2px; }
button {
  border: 0; border-radius: 9px; padding: 10px 15px; color: #fff; background: var(--blue);
  cursor: pointer; font-weight: 650; transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
button:hover { background: var(--blue-dark); box-shadow: 0 5px 12px rgba(53,105,212,.18); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
button.danger { background: var(--red); }
button.danger:hover { background: #a72d37; }
button.ghost { color: #42516b; background: #eef1f6; }
button.ghost:hover { color: var(--ink); background: #e2e8f1; box-shadow: none; }
input, select {
  width: 100%; min-height: 42px; padding: 10px 12px; color: var(--ink); background: #fff;
  border: 1px solid #dce3ed; border-radius: 9px; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: #7da2ed; box-shadow: 0 0 0 3px rgba(53,105,212,.11); }
label { display: block; font-size: 12px; font-weight: 700; color: #45536a; margin: 12px 0 5px; }
form button { margin-top: 8px; }
.row { display: flex; gap: 9px; align-items: center; }
.row > * { flex: 1; }
.row > button { flex: 0 0 auto; }
.search-row { display: flex; gap: 10px; max-width: 470px; }
.search-row input { background: #f9fbfe; }
.table-wrap { overflow-x: auto; width: 100%; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 560px; background: #fff; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
th { color: #68758b; background: #f8faff; font-size: 10px; text-transform: uppercase; letter-spacing: .7px; font-weight: 800; white-space: nowrap; }
td { color: #344158; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td button { padding: 7px 10px; font-size: 11px; margin: 2px 2px 2px 0; }
.err { color: var(--red); font-size: 11px; min-height: 3px; margin-top: 3px; }
.empty-state, .loading-state { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty-icon { font-size: 28px; margin-bottom: 8px; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 17px; color: var(--muted); font-size: 12px; }
.pagination button { padding: 8px 12px; }
.form-card { max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 9px; margin-top: 13px; }
.auth-shell { max-width: 900px; margin: 38px auto; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 20px 55px rgba(18,40,76,.13); border: 1px solid var(--line); }
.auth-aside { padding: 42px 35px; color: #fff; background: linear-gradient(145deg, #142b4a, #244b7c); display: flex; flex-direction: column; justify-content: space-between; min-height: 440px; }
.auth-aside h2 { font-size: 27px; line-height: 1.2; margin: 25px 0 12px; }
.auth-aside p { color: #d3deed; font-size: 13px; }
.auth-feature { border-top: 1px solid rgba(255,255,255,.18); padding-top: 17px; color: #dce7f7; font-size: 12px; }
.auth-form { padding: 42px 38px; }
.auth-form h2 { margin-bottom: 6px; }
.auth-form .subtitle { font-size: 12px; margin-bottom: 22px; }
.auth-form button { width: 100%; margin-top: 18px; min-height: 44px; }
.auth-switch { color: var(--muted); text-align: center; font-size: 12px; margin: 18px 0 0; }
.auth-switch a { color: var(--blue); text-decoration: none; font-weight: 700; }
#toast { position: fixed; z-index: 30; top: 20px; right: 20px; max-width: min(390px, calc(100% - 40px)); padding: 12px 17px; border-radius: 11px; color: #fff; display: none; box-shadow: 0 10px 28px #17233b2a; font-size: 13px; font-weight: 650; }
#toast.ok { background: var(--green); }
#toast.bad { background: var(--red); }
.status-pill { display: inline-flex; border-radius: 30px; padding: 4px 9px; font-size: 10px; font-weight: 750; background: var(--amber-soft); color: var(--amber); }
.status-pill.returned { background: var(--green-soft); color: var(--green); }
footer { color: #8994a7; text-align: center; padding: 20px; font-size: 11px; }
@media (max-width: 760px) {
  nav { padding: 12px 18px; gap: 4px; }
  .brand { width: 100%; margin: 0 0 5px; }
  nav a { padding: 8px 9px; font-size: 12px; }
  .nav-user { margin-left: auto; }
  main { width: min(100% - 28px, 600px); margin-top: 24px; }
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 17px; }
  .stat-value { font-size: 25px; }
  .quick-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .card { padding: 16px; border-radius: 13px; }
  .auth-shell { grid-template-columns: 1fr; margin: 20px auto; }
  .auth-aside { min-height: auto; padding: 25px; }
  .auth-aside h2 { margin: 18px 0 8px; font-size: 22px; }
  .auth-feature { margin-top: 18px; }
  .auth-form { padding: 27px 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-row { max-width: none; }
}
@media (max-width: 420px) {
  .nav-user { display: none; }
  .search-row { flex-direction: column; }
  .search-row button { width: 100%; }
  .pagination { justify-content: space-between; gap: 5px; }
}
.detail-modal {
  background: var(--card, #fff);
  color: var(--text, #222);
  padding: 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border, #eee);
  margin-bottom: 12px;
}

.detail-header h2 {
  margin: 0 0 6px;
}

.detail-header p {
  margin: 0;
  opacity: .65;
  font-size: 13px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border, #eee);
}

.detail-label {
  opacity: .65;
  flex: 1;
}

.detail-value {
  font-weight: 600;
  text-align: right;
  flex: 1;
  overflow-wrap: anywhere;
}

.detail-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #eee);
}

.detail-group-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-nested {
  padding-left: 12px;
  border-left: 2px solid var(--border, #ddd);
}

@media (max-width: 500px) {
  .detail-modal {
    padding: 18px;
  }

  .detail-row {
    flex-direction: column;
    gap: 5px;
  }

  .detail-value {
    text-align: left;
  }
}