* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #1f2937;
  background: #f3f4f6;
}

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #fff; padding: 32px; border-radius: 12px; width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0 0 8px; font-size: 20px; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #6b7280; }
.login-card input {
  padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.login-card button {
  margin-top: 8px; padding: 10px; border: 0; border-radius: 8px;
  background: #2563eb; color: #fff; font-size: 15px; cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }
.error { color: #dc2626; font-size: 13px; margin: 0; text-align: center; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid #e5e7eb;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar .sub { font-size: 13px; color: #6b7280; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.updated { font-size: 12px; color: #6b7280; }
.logout { font-size: 13px; color: #2563eb; text-decoration: none; }
.logout:hover { text-decoration: underline; }

main { padding: 24px; }
.status { color: #6b7280; font-size: 14px; margin: 12px 0; }

/* Bộ chọn bưu cục */
.picker {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.picker-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.picker-head h2 { margin: 0; font-size: 16px; }
.picker-info { font-size: 12px; color: #6b7280; }
.bc-search {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; margin-bottom: 10px;
}
.picker-actions { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.btn-light {
  padding: 8px 12px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 8px;
  font-size: 13px; cursor: pointer; color: #374151;
}
.btn-light:hover { background: #f3f4f6; }
.btn-primary {
  padding: 8px 16px; border: 0; background: #2563eb; color: #fff; border-radius: 8px;
  font-size: 13px; cursor: pointer; margin-left: auto;
}
.btn-primary:hover { background: #1d4ed8; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: #eff6ff; color: #1e40af;
  border: 1px solid #bfdbfe; border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px;
  max-width: 320px;
}
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x {
  border: 0; background: transparent; color: #1e40af; font-size: 16px; line-height: 1;
  cursor: pointer; padding: 0 2px;
}
.chip-x:hover { color: #dc2626; }

.bc-list {
  max-height: 320px; overflow-y: auto; border: 1px solid #f1f5f9; border-radius: 8px;
}
.bc-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid #f6f7f9; font-size: 14px; cursor: pointer;
}
.bc-item:last-child { border-bottom: 0; }
.bc-item:hover { background: #f9fafb; }
.bc-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-item-total {
  font-size: 12px; color: #6b7280; background: #f3f4f6; border-radius: 999px;
  padding: 1px 8px; min-width: 28px; text-align: center;
}
.bc-more { padding: 10px 12px; font-size: 13px; color: #6b7280; }

/* Bảng */
#board { margin-top: 20px; }
.board-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.board-title { margin: 0; font-size: 16px; font-weight: 600; color: #111827; }
.board-total { font-size: 13px; color: #6b7280; }
.board-empty {
  color: #6b7280; font-size: 14px; background: #fff; border-radius: 10px;
  padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 14px; text-align: center; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
th { background: #f8fafc; font-weight: 600; color: #374151; position: sticky; top: 0; }
.col-name { text-align: left; font-weight: 500; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
th:first-child { text-align: left; }
.col-total { font-weight: 700; background: #f8fafc; }
td.zero { color: #d1d5db; }
tbody tr:hover { background: #f9fafb; }
tbody tr.row-zero .col-name { color: #9ca3af; font-style: italic; }
.bc-item-total.zero { color: #9ca3af; background: #f9fafb; }
tfoot td { font-weight: 700; background: #eef2ff; border-top: 2px solid #c7d2fe; }

td.clickable { cursor: pointer; color: #2563eb; }
td.clickable:hover { background: #eff6ff; text-decoration: underline; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-box {
  position: relative; background: #fff; border-radius: 12px; width: min(560px, 92vw);
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-sub { font-size: 13px; color: #6b7280; margin-top: 2px; }
.modal-close {
  border: 0; background: transparent; font-size: 24px; line-height: 1;
  color: #9ca3af; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: #374151; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; }
.modal-empty { color: #6b7280; font-size: 14px; padding: 12px 0; }

.ticket-list { list-style: none; margin: 0; padding: 0; }
.ticket-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px;
}
.ticket-list li:last-child { border-bottom: 0; }
.ticket-num { color: #2563eb; text-decoration: none; font-weight: 600; white-space: nowrap; }
.ticket-num:hover { text-decoration: underline; }
.ticket-order { color: #6b7280; white-space: nowrap; }
.ticket-title { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
