/* Giao diện quanly.nrtk.vn, dùng cùng hệ màu và kiểu bảng với bản clone noibo. */
:root {
  --blue: #2463eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf0fe;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f6f8fb;
  --white: #ffffff;
  --green: #047857;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

/* Thuộc tính hidden bị các rule display:flex/display:grid phía dưới ghi đè, phải ép ẩn. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- khung trang */
.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 18px;
  font-weight: 600;
  font-size: 15px;
}

.sidebar__brand span.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--blue);
  display: inline-block;
}

.sidebar__label {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  color: #374151;
  font-weight: 500;
}
.nav-item:hover { background: #f3f4f6; text-decoration: none; }
.nav-item.is-active { background: var(--blue-soft); color: var(--blue); }
.nav-item__count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  text-align: center;
}

.sidebar__foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.main { padding: 24px 28px 48px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
}
.topbar p { margin: 0; color: var(--muted); font-size: 13px; }

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}
.userbox__mail { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- thành phần */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat__label { color: var(--muted); font-size: 12px; }
.stat__value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat--pending .stat__value { color: var(--amber); }
.stat--active .stat__value { color: var(--green); }
.stat--locked .stat__value { color: var(--red); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.toolbar__spacer { flex: 1 1 auto; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border);
  background: var(--white);
  color: #374151;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.tab.is-active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.tab b { font-weight: 600; }

input[type="search"], input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  background: var(--white);
  min-width: 220px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: var(--white);
  color: #111827;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: #f9fafb; }
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover { background: #991b1b; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- bảng */
.table-wrap { overflow: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th, .table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table thead th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody tr:hover { background: #fbfcfe; }
.table tbody tr.is-clickable { cursor: pointer; }
.table td.nowrap { white-space: nowrap; }
.cell-main { font-weight: 500; }
.cell-sub { color: var(--muted); font-size: 12.5px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge--pending { background: var(--amber-soft); color: var(--amber); }
.badge--active { background: var(--green-soft); color: var(--green); }
.badge--locked { background: var(--red-soft); color: var(--red); }
.badge--rejected { background: #f3f4f6; color: #4b5563; }
.badge--provider { background: var(--blue-soft); color: var(--blue); }

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- chi tiết */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.section { padding: 18px 20px; }
.section h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #7c2d12;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.note--info { border-left-color: var(--blue); background: var(--blue-soft); color: #1e3a8a; }

/* ---------------------------------------------------------------- modal, toast */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal[hidden] { display: none; }
.modal__card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(16, 24, 40, .2);
  padding: 20px;
}
.modal__card h3 { margin: 0 0 8px; font-size: 16px; }
.modal__card p { margin: 0 0 14px; color: var(--muted); }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: #374151; font-weight: 500; }
.field input, .field select { width: 100%; min-width: 0; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast__item {
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(17, 24, 39, .25);
  font-size: 13px;
  max-width: 360px;
}
.toast__item--error { background: var(--red); }

/* ---------------------------------------------------------------- trang đăng nhập */
.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #e6f7f1 0%, #d9ecff 100%);
}
.auth__card {
  width: 100%;
  max-width: 430px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, .12);
  padding: 28px;
}
.auth__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.auth__brand span.dot { width: 12px; height: 12px; border-radius: 4px; background: var(--blue); }
.auth__title { font-size: 20px; font-weight: 600; margin: 14px 0 4px; }
.auth__sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.auth__form { display: flex; flex-direction: column; gap: 12px; }
.auth__form input { width: 100%; min-width: 0; height: 42px; }
.auth__form .btn { height: 42px; justify-content: center; }
.auth__msg { min-height: 20px; font-size: 13px; color: var(--red); }
.auth__foot { margin-top: 16px; font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar__brand { padding: 4px 8px; }
  .sidebar__label, .sidebar__foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .detail { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
}
