:root {
  --blue: #154ab7;
  --pink: #eea4b8;
  --cream: #fff9ef;
  --ink: #17234a;
  --line: #e9e1d5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 14px 'Be Vietnam Pro', sans-serif;
}

.admin-shell {
  max-width: 1120px;
  margin: auto;
  padding: 38px 30px;
}

.back {
  text-decoration: none;
  font-size: 12px;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
}

h1,
h2 {
  font-family: 'Playfair Display', serif;
}

h1 {
  font-size: 42px;
  line-height: 1;
  margin: 10px 0;
}

h1 i {
  color: var(--blue);
}

.login {
  max-width: 430px;
  margin: 12vh auto;
}

.login > p:not(.eyebrow) {
  line-height: 1.7;
  color: #677088;
}

form {
  display: grid;
  gap: 12px;
  margin-top: 25px;
}

input,
textarea,
select {
  font: inherit;
  padding: 13px;
  border: 1px solid var(--line);
  background: #fff;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

form button,
.add {
  background: var(--blue);
  color: #fff;
  padding: 13px 18px;
  font-weight: 700;
}

.login small {
  display: block;
  color: #a64a55;
  margin-top: 13px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header > button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 13px;
}

.tabs {
  border-bottom: 1px solid var(--line);
  margin: 38px 0 25px;
  display: flex;
  gap: 25px;
}

.tabs button {
  padding: 11px 4px;
  background: none;
}

.tabs button.active {
  color: var(--blue);
  border-bottom: 2px solid var(--blue);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
}

th,
td {
  text-align: left;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

th {
  color: #737b90;
  background: #fffdf8;
}

.name {
  font-weight: 700;
}

.status {
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 10px;
}

.status.on {
  background: #dff4e8;
  color: #17734a;
}

.status.off {
  background: #f5e3e5;
  color: #a64a55;
}

.edit {
  color: var(--blue);
  font-weight: 700;
  background: none;
}

/* =========================
   PRODUCT FORM
========================= */

dialog {
  border: 0;
  width: min(600px, 92vw);
  padding: 30px;
  background: #fffaf2;
  box-shadow: 0 8px 40px #0003;
}

dialog::backdrop {
  background: #17234a88;
}

.close {
  float: right;
  font-size: 27px;
  background: none;
}

.form-title {
  margin-top: 0;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fields .wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.check input {
  width: auto;
}

/* =========================
   THÔNG BÁO THƯỜNG
========================= */

/*
   #notice mặc định là toast nhỏ:
   "Đã lưu sản phẩm thành công!"
   "Đã cập nhật trạng thái"
   ...
*/

#notice {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);

  width: max-content;
  max-width: calc(100vw - 40px);

  box-sizing: border-box;
  padding: 12px 20px;

  background: var(--ink);
  color: #fff;

  border-radius: 999px;

  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;

  text-align: center;

  display: none;

  z-index: 9999;

  box-shadow: 0 10px 30px rgba(23, 35, 74, .18);
}

/* =========================
   POPUP ĐƠN HÀNG MỚI
========================= */

/*
   Khi #notice chứa .new-order-notice
   thì nó biến thành popup góc phải.
*/

#notice:has(.new-order-notice) {
  position: fixed;
  top: 24px;
  right: 24px;
  left: auto;
  bottom: auto;

  transform: none;

  width: min(380px, calc(100vw - 32px));
  max-width: none;

  padding: 0;

  background: #fffaf2;
  color: var(--ink);

  border: 1px solid #eadfcf;
  border-radius: 18px;

  box-shadow:
    0 18px 50px rgba(30, 45, 80, 0.18);

  overflow: hidden;

  animation: noticeIn 0.35s ease;
}

.new-order-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
}

.new-order-icon {
  width: 44px;
  height: 44px;

  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #eaf1ff;
  border-radius: 50%;

  font-size: 22px;
}

.new-order-content {
  flex: 1;

  display: flex;
  flex-direction: column;
  gap: 5px;
}

.new-order-content strong:first-child {
  font-size: 16px;
  color: #172554;
  margin-bottom: 3px;
}

.new-order-content span {
  font-size: 13px;
  color: #64748b;
}

.new-order-content b {
  color: #1d4ed8;
}

.new-order-close {
  border: 0;
  background: transparent;

  width: 28px;
  height: 28px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  color: #94a3b8;
  font-size: 22px;
  line-height: 1;

  border-radius: 50%;
}

.new-order-close:hover {
  background: #f1f5f9;
  color: #334155;
}

@keyframes noticeIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================
   IMAGE UPLOAD
========================= */

.image-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 14px;

  border: 1px dashed #ccc;
  border-radius: 12px;
}

.image-upload span {
  font-weight: 700;
}

.image-upload input[type="file"] {
  width: 100%;
}

.image-upload small {
  color: #777;
}

/* =========================
   ORDER DETAIL
========================= */

#orderDetail {
  width: min(680px, calc(100vw - 32px));
  max-height: 90vh;

  padding: 0;

  border: none;
  border-radius: 20px;

  background: #fffaf3;
  color: #17233f;

  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

#orderDetail::backdrop {
  background: rgba(20, 30, 50, 0.55);
  backdrop-filter: blur(3px);
}

#orderDetail .close {
  position: absolute;

  top: 18px;
  right: 20px;

  width: 36px;
  height: 36px;

  border: none;
  background: transparent;

  font-size: 24px;
  cursor: pointer;
}

.order-detail {
  padding: 32px;
}

.order-detail h2 {
  margin: 0 40px 22px 0;

  font-family: "Playfair Display", serif;
  font-size: 30px;
}

.order-detail h3 {
  margin: 22px 0 14px;

  font-size: 14px;
  letter-spacing: 0.08em;
}

.order-detail hr {
  border: 0;
  border-top: 1px solid #e7dfd3;

  margin: 22px 0;
}

.order-detail-code,
.order-detail-status {
  display: flex;
  justify-content: space-between;

  gap: 20px;
  margin: 8px 0;
}

.order-detail-code strong {
  color: #315fc4;
  font-size: 18px;
}

.customer-info p {
  margin: 7px 0;
}

.order-item {
  display: flex;
  justify-content: space-between;

  gap: 20px;
  padding: 12px 0;

  border-bottom: 1px solid #eee5d8;
}

.order-item div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-item span {
  color: #777;
  font-size: 14px;
}

.order-total p {
  display: flex;
  justify-content: space-between;

  margin: 10px 0;
}

.grand-total {
  padding-top: 12px;

  border-top: 2px solid #17233f;

  font-size: 20px;
}

.print-order {
  width: 100%;
  margin-top: 22px;
}

/* =========================
   ORDER BADGE
========================= */

.order-badge {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  min-width: 20px;
  height: 20px;

  padding: 0 6px;
  margin-left: 6px;

  background: #d92d20;
  color: white;

  border-radius: 999px;

  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.order-badge[hidden] {
  display: none;
}

/* =========================
   NHẬN DIỆN ĐƠN CHƯA XEM
========================= */

#orderRows tr.order-unseen {
  background: #f4f8ff;
}

#orderRows tr.order-unseen:hover {
  background: #edf4ff;
}

#orderRows tr.order-seen {
  background: transparent;
}

.unread-order-code {
  font-weight: 800;
  color: #1557c0;
}

.unread-label {
  display: inline-flex;

  align-items: center;

  margin-left: 8px;
  padding: 4px 8px;

  border-radius: 999px;

  background: #e8f1ff;
  color: #1557c0;

  font-size: 11px;
  font-weight: 700;

  white-space: nowrap;
}

.order-unseen td:first-child {
  border-left: 3px solid #2563eb;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 600px) {

  .admin-shell {
    padding: 25px 18px;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .fields .wide {
    grid-column: auto;
  }

  .order-detail {
    padding: 24px;
  }

  .order-detail h2 {
    font-size: 25px;
  }

  .order-detail-code,
  .order-detail-status {
    flex-direction: column;
    gap: 4px;
  }

  #notice {
    bottom: 20px;
    max-width: calc(100vw - 32px);
  }

  #notice:has(.new-order-notice) {
    top: 16px;
    right: 16px;
    left: auto;
    bottom: auto;

    width: calc(100vw - 32px);
  }
}

/* =========================
   IN PHIẾU J&T
   ========================= */

@media print {

  /* =========================
     CHỈ HIỆN PHIẾU KHI IN
     ========================= */

  body > * {
    display: none !important;
  }

  #orderDetail {
    display: block !important;
    visibility: visible !important;
  }

  #orderDetail * {
    visibility: visible !important;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* =========================
     KHUNG PHIẾU
     ========================= */

  #orderDetail {
    position: absolute !important;
    inset: 0 !important;

    width: 100% !important;
    max-width: none !important;

    height: auto !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    border: none !important;
    box-shadow: none !important;

    background: #fff !important;

    overflow: visible !important;
  }

  #orderDetail::backdrop {
    display: none !important;
  }

  #orderDetailContent {
    width: 100% !important;
    padding: 0 !important;
  }

  /* =========================
     PHIẾU
     ========================= */

  .order-detail {
    width: 100% !important;
    max-width: 520px !important;

    margin: 0 auto !important;
    padding: 28px !important;

    box-sizing: border-box !important;

    color: #111 !important;
    background: #fff !important;

    font-family: Arial, Helvetica, sans-serif !important;
  }

  /* =========================
     TÊN SHOP
     ========================= */

  .order-detail::before {
    content: "THÊM 78";

    display: block;

    text-align: center;

    font-size: 24px;
    font-weight: 800;

    letter-spacing: 2px;

    margin-bottom: 20px;
  }

  /* =========================
     ẨN NÚT ĐÓNG
     ========================= */

  #orderDetail > .close {
    display: none !important;
  }

  /* =========================
     MÃ ĐƠN
     ========================= */

  .order-detail-code {
    display: flex !important;

    justify-content: space-between !important;
    align-items: center !important;

    margin-bottom: 14px !important;
  }

  .order-detail-code span {
    font-size: 11px !important;
    color: #555 !important;
  }

  .order-detail-code strong {
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  /* =========================
     MÃ VẬN ĐƠN J&T
     ========================= */

  .jnt-tracking-box {
    margin: 14px 0 22px !important;
    padding: 16px !important;

    border: 2px solid #111 !important;
    border-radius: 8px !important;

    text-align: center !important;
  }

  .jnt-tracking-box label {
    display: block !important;

    margin-bottom: 7px !important;

    font-size: 10px !important;
    font-weight: 700 !important;

    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
  }

  .jnt-tracking-row {
    display: block !important;
  }

  .jnt-tracking-row input {
    display: block !important;

    width: 100% !important;

    padding: 4px 0 !important;

    border: none !important;
    outline: none !important;

    background: transparent !important;

    text-align: center !important;

    font-size: 36px !important;
    font-weight: 900 !important;

    letter-spacing: 3px !important;

    color: #000 !important;
  }

  /* Không in nút Lưu mã */
  .jnt-tracking-row button {
    display: none !important;
  }

  /* =========================
     ẨN TRẠNG THÁI
     ========================= */

  .order-detail-status {
    display: none !important;
  }

  /* =========================
     TIÊU ĐỀ CÁC PHẦN
     ========================= */

  .order-detail h3 {
    margin: 18px 0 8px !important;

    font-size: 11px !important;
    font-weight: 800 !important;

    letter-spacing: 1px !important;
  }

  /* =========================
     THÔNG TIN KHÁCH
     ========================= */

  .customer-info {
    font-size: 12px !important;
    line-height: 1.55 !important;
  }

  .customer-info p {
    margin: 3px 0 !important;
  }

  /* Không in email */
  .customer-email {
    display: none !important;
  }

  /* =========================
     SẢN PHẨM
     ========================= */

  .order-items {
    margin-top: 6px !important;
  }

  .order-item {
    display: flex !important;

    justify-content: space-between !important;

    gap: 12px !important;

    padding: 9px 0 !important;

    border-bottom: 1px dashed #bbb !important;

    font-size: 12px !important;
  }

  .order-item > div {
    display: flex !important;

    flex-direction: column !important;

    gap: 2px !important;
  }

  /* =========================
     TỔNG TIỀN
     ========================= */

  .order-total {
    margin-top: 14px !important;
  }

  .order-total p {
    display: flex !important;

    justify-content: space-between !important;

    margin: 5px 0 !important;

    font-size: 12px !important;
  }

  .order-total .grand-total {
    margin-top: 12px !important;

    padding-top: 10px !important;

    border-top: 2px solid #111 !important;

    font-size: 18px !important;
  }

  /* =========================
     ẨN NÚT IN
     ========================= */

  .order-print-actions,
  .print-order {
    display: none !important;
  }

  /* =========================
     KHỔ GIẤY
     ========================= */

  @page {
    size: A4;
    margin: 10mm;
  }
}


/* =========================
   TÌM KIẾM ĐƠN HÀNG
   ========================= */

.order-search {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 18px 0 8px;
}

.order-search input {
  width: 100%;
  height: 48px;

  box-sizing: border-box;

  padding: 0 48px 0 44px;

  border: 1px solid #dfe5ef;
  border-radius: 14px;

  background: #fff;

  color: #17234a;

  font-family: inherit;
  font-size: 14px;

  outline: none;

  transition: .2s ease;
}

.order-search input::placeholder {
  color: #9aa3b5;
}

.order-search input:focus {
  border-color: #8aa9df;
  box-shadow: 0 0 0 4px rgba(58, 105, 190, .08);
}

.order-search-icon {
  position: absolute;

  left: 16px;
  top: 50%;

  transform: translateY(-50%);

  font-size: 22px;
  color: #71809d;

  pointer-events: none;
}

.order-search-clear {
  position: absolute;

  right: 10px;
  top: 50%;

  width: 30px;
  height: 30px;

  transform: translateY(-50%);

  border: none;
  border-radius: 50%;

  background: #eef2f8;
  color: #52617c;

  font-size: 20px;
  line-height: 1;

  cursor: pointer;
}

.order-search-clear:hover {
  background: #e1e7f0;
}

.order-search-meta {
  min-height: 18px;

  margin: 6px 0 12px;

  color: #8a94a8;

  font-size: 12px;
}

.order-search-empty {
  padding: 28px !important;

  text-align: center;

  color: #8a94a8;
}