/* ==========================================================================
   Thiên An USA – admin panel styles
   ========================================================================== */
[hidden] { display: none !important; }

:root {
  --red: #a06853;
  --red-dark: #87543f;
  --red-soft: #faf0ea;
  --gold: #bda57f;
  --ink: #37322c;
  --ink-2: #514a42;
  --muted: #6f675c;
  --line: #ece5dd;
  --bg: #faf7f3;
  --sidebar: #fdfaf6;
  --sidebar-2: #f6efe5;
  --green: #4f7159;
  --green-soft: #edf3ef;
  --amber: #8a6642;
  --amber-soft: #f8f0e0;
  --blue: #4f6a7d;
  --blue-soft: #eef2f6;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(88, 72, 55, .07);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 23px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 800; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
.admin-muted { color: var(--muted); font-size: 13px; }
.admin-hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* ------------------------------------------------------------------ shell */
.admin-shell { min-height: 100vh; }
.admin-sidebar {
  position: fixed; inset: 0 auto 0 0; width: 258px; background: var(--sidebar);
  color: #6f665c; display: flex; flex-direction: column; z-index: 70;
  border-right: 1px solid var(--line);
}
.admin-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; border-bottom: 1px solid var(--line); }
.admin-brand-mark {
  width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(145deg, var(--red), var(--red-dark));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px; letter-spacing: .03em; flex: none;
  box-shadow: 0 6px 14px rgba(160, 104, 83, .22);
}
.admin-brand-mark.lg { width: 58px; height: 58px; font-size: 21px; border-radius: 16px; }
.admin-brand-logo { height: 40px; width: auto; max-width: 150px; object-fit: contain; display: block; flex: none; }
.admin-brand-logo.lg { height: 58px; max-width: 210px; }
.admin-brand-text { display: flex; flex-direction: column; line-height: 1.15; color: var(--ink); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: -.01em; }
.admin-brand-text small { color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: none; letter-spacing: .02em; margin-top: 2px; }
.admin-nav { padding: 12px 10px 20px; overflow-y: auto; flex: 1; }
.admin-nav::-webkit-scrollbar { width: 6px; }
.admin-nav::-webkit-scrollbar-thumb { background: #e6dccd; border-radius: 10px; }
.nav-label {
  display: block; padding: 14px 12px 6px; font-size: 9.5px; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; color: #6f675c;
}
.admin-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: #6f665c; margin-bottom: 1px;
  transition: background .15s, color .15s;
}
.admin-nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.admin-nav a:hover { background: var(--red-soft); color: var(--red-dark); }
.admin-nav a:hover svg { opacity: 1; }
.admin-nav a.active { background: linear-gradient(90deg, #f6e7df, #fbf3ee); color: var(--red-dark); box-shadow: inset 0 0 0 1px #f0ddd1; }
.admin-nav a.active svg { opacity: 1; }
.admin-sidebar-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.admin-sidebar-foot a { color: var(--muted); }
.admin-sidebar-foot a:hover { color: var(--red-dark); }

.admin-main { margin-left: 258px; min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar {
  position: sticky; top: 0; z-index: 50; height: 64px; background: #fff;
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
}
.admin-menu-btn { display: none; border: 0; background: #f9f5ef; border-radius: 9px; width: 38px; height: 38px; align-items: center; justify-content: center; color: var(--ink-2); }
.admin-topbar-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; cursor: pointer; padding: 6px 8px; border-radius: 10px; }
.admin-user:hover { background: #fbf7f2; }
.admin-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--red-soft); color: var(--red);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; font-size: 14px;
}
.admin-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.admin-user-info strong { font-size: 13px; }
.admin-user-info small { font-size: 11px; color: var(--muted); }
.admin-user-menu {
  position: absolute; top: calc(100% + 6px); right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; display: none;
}
.admin-user:hover .admin-user-menu { display: block; }
.admin-user-menu a { display: block; padding: 8px 10px; border-radius: 7px; font-size: 13px; }
.admin-user-menu a:hover { background: #fbf7f2; color: var(--red); }
.admin-content { padding: 26px; flex: 1; max-width: 1500px; width: 100%; }
.admin-footer { padding: 16px 26px 26px; color: #6f675c; font-size: 12px; }
.admin-flash-wrap { padding: 18px 26px 0; display: grid; gap: 8px; }

/* ------------------------------------------------------------------ flash */
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
}
.flash-success { background: var(--green-soft); color: #46654f; border-color: #d3e5d8; }
.flash-danger { background: var(--red-soft); color: #87543f; border-color: #edd6c9; }
.flash-warning { background: var(--amber-soft); color: var(--amber); border-color: #f0e0c0; }
.flash-info { background: var(--blue-soft); color: #5d7085; border-color: #dee5ec; }
.flash-close { border: 0; background: transparent; font-size: 19px; line-height: 1; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* --------------------------------------------------------------- headings */
.admin-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-page-head h1 { margin-bottom: 3px; }
.admin-page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.admin-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 13px; line-height: 1.2; transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 5px 14px rgba(160, 104, 83, .2); }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #efe8df; color: var(--ink); }
.btn-danger { background: #b0705a; color: #fff; }
.btn-danger:hover { background: #9c6450; }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(88, 72, 55, .03); margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 20px 0; }
.card-head h2 { margin-bottom: 2px; }
.card-head p { margin: 0; color: var(--muted); font-size: 12px; }
.card > .table-wrap { padding: 10px 0 0; }
.card > p, .card > .admin-muted, .card > .detail-rows, .card > .admin-list, .card > .inline-actions, .card > .stack-form, .card > .order-current, .card > .card-body { margin-left: 20px; margin-right: 20px; }
.card > p:last-child, .card > .admin-muted:last-child { margin-bottom: 18px; }

.admin-grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
.admin-grid-2 > .card { margin-bottom: 0; }
.admin-grid-2 > *, .order-detail-grid > *, .customer-detail-grid > *, .profile-grid > *, .form-layout > * { min-width: 0; }

/* ------------------------------------------------------------------ stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: flex-start; gap: 13px;
}
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-icon svg { width: 21px; height: 21px; }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-card > div { display: flex; flex-direction: column; min-width: 0; }
.stat-card span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-card strong { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 1px 0; }
.stat-card small { font-size: 11.5px; color: var(--muted); }
.stat-card small.warn { color: #8a6642; font-weight: 600; }

/* ------------------------------------------------------------------ chart */
.chart { padding: 20px 20px 10px; }
.chart-bars { display: flex; align-items: flex-end; gap: 7px; height: 250px; padding-top: 18px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; position: relative; }
.chart-value { font-size: 9px; color: var(--muted); font-weight: 700; height: 12px; }
.chart-bar {
  width: 100%; max-width: 46px; border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #b8806a, var(--red));
  transition: filter .15s; min-height: 3px;
}
.chart-col:hover .chart-bar { filter: brightness(1.12); }
.chart-label { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.chart-dense .chart-label { visibility: hidden; }
.chart-dense .chart-col:nth-child(7n) .chart-label { visibility: visible; }
.chart-dense .chart-value { display: none; }

.status-breakdown { padding: 16px 20px 4px; display: grid; gap: 12px; }
.status-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 12.5px; }
.progress { height: 7px; border-radius: 999px; background: #f7f2ea; overflow: hidden; }
.progress-bar { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #b8806a, var(--red)); }
.status-bg-pending { background: #d8a86a; }
.status-bg-confirmed { background: #8ba2b6; }
.status-bg-shipping { background: #8fabc0; }
.status-bg-completed { background: #7fae8b; }
.status-bg-cancelled { background: #bd7b63; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 20px 20px; }
.quick-action {
  background: #fbf7f3; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  font-size: 11.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px;
}
.quick-action strong { font-size: 17px; color: var(--red); }
.quick-action:hover { border-color: var(--red); }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); background: #fcf9f5; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-weight: 800;
}
.table td { padding: 11px 14px; border-bottom: 1px solid #f8f4ee; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fefcf9; }
.table-link { color: var(--ink); font-weight: 700; }
.table-link:hover { color: var(--red); }
.table-sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.table-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table-product img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #f9f5ef; border: 1px solid var(--line); flex: none; }
.table-product > div { min-width: 0; }
.table-product strong { font-size: 13px; }
.th-actions, .td-actions { text-align: right; white-space: nowrap; }
.td-actions { display: flex; justify-content: flex-end; gap: 5px; }
.td-actions form { display: inline-flex; }
.mini-btn {
  min-width: 29px; height: 29px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; transition: .15s;
}
.mini-btn:hover { background: #f9f5ef; border-color: #ddd4c6; }
.mini-btn.danger { color: #9c6450; }
.mini-btn.danger:hover { background: var(--red-soft); border-color: #edd6c9; }
.admin-pagination-wrap { padding: 14px 20px 18px; }
.pagination { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.page-link {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.page-link:hover { border-color: var(--red); color: var(--red); }
.page-link.active { background: var(--red); border-color: var(--red); color: #fff; }
.page-dots { padding: 0 3px; color: var(--muted); align-self: center; }

/* ------------------------------------------------------------------ badge */
.status {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; background: #f8f4ee; color: #6f665c;
}
.status-active, .status-completed, .status-paid, .status-approved { background: var(--green-soft); color: #46654f; }
.status-hidden, .status-cancelled, .status-refunded, .status-rejected { background: var(--red-soft); color: #87543f; }
.status-pending, .status-unpaid { background: var(--amber-soft); color: var(--amber); }
.status-confirmed { background: var(--blue-soft); color: var(--blue); }
.status-shipping { background: #eff3f7; color: #4d6577; }
.role-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #f8f4ee; color: #6f665c; }
.role-admin { background: var(--red-soft); color: #87543f; }
.role-staff { background: var(--blue-soft); color: var(--blue); }
.stock-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.stock-pill.danger { background: var(--red-soft); color: #87543f; }
.stock-pill.warn { background: var(--amber-soft); color: var(--amber); }

/* ------------------------------------------------------------------- tabs */
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.status-tabs a {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 9px;
  background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.status-tabs a span { background: #f8f4ee; border-radius: 999px; padding: 1px 7px; font-size: 10.5px; color: var(--muted); }
.status-tabs a:hover { border-color: #d8cfc1; }
.status-tabs a.active { background: var(--red); border-color: var(--red); color: #fff; }
.status-tabs a.active span { background: rgba(255, 255, 255, .22); color: #fff; }
.mini-stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.mini-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted);
}
.mini-stat strong { font-size: 16px; color: var(--ink); }
.mini-stat.active { border-color: var(--red); background: var(--red-soft); }
.mini-stat.active strong { color: var(--red); }

/* --------------------------------------------------------------- filtering */
.filter-bar { display: flex; gap: 9px; flex-wrap: wrap; padding: 16px 20px; align-items: center; border-bottom: 1px solid var(--line); }
.filter-bar input[type="search"], .filter-bar input[type="text"], .filter-bar select, .filter-bar input[type="date"] {
  padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 8px; outline: none; background: #fff; font-size: 13px; font-weight: 500; color: var(--ink);
}
.filter-bar input[type="search"] { min-width: 240px; flex: 1; max-width: 340px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--red); }
.filter-date { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.card > .filter-bar { padding: 16px 20px; }
.stock-form { display: flex; align-items: center; gap: 4px; }
.stock-form input { width: 58px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; text-align: center; font-size: 12.5px; font-weight: 700; outline: none; }
.stock-form input:focus { border-color: var(--red); }
/* Ô sửa nhanh lượt xem ngay dưới tên sản phẩm trong danh sách. */
.views-form { margin-top: 4px; }
.views-form input { width: 68px; }
.views-form .mini-btn { color: var(--muted); }
.star-toggle { border: 0; background: transparent; font-size: 17px; color: #ddd4c6; padding: 2px 4px; }
.star-toggle.on { color: #d3a878; }

/* ------------------------------------------------------------------ forms */
.form-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.form-main, .form-side { display: grid; gap: 20px; }
.form-main > .card, .form-side > .card { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 20px 20px; }
.form-side .form-grid { grid-template-columns: 1fr; }
.field { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px; border: 1.5px solid var(--line);
  border-radius: 8px; outline: none; background: #fff; font-size: 13px; font-weight: 400; color: var(--ink);
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { resize: vertical; }
.field-full { grid-column: 1 / -1; }
.field-hint { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 400; }
.card > .field { margin: 14px 20px; }
.card > .field + .field { margin-top: 10px; }
.card > .field-hint { margin: 0 20px 16px; }
.form-side .card > .field { margin-left: 20px; margin-right: 20px; }
.switch-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 20px; border-top: 1px solid #f8f4ee;
  cursor: pointer; margin: 0;
}
.switch-row:first-of-type { border-top: 0; }
.switch-row input { margin-top: 3px; accent-color: var(--red); width: 15px; height: 15px; flex: none; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row strong { font-size: 12.5px; }
.switch-row small { font-size: 11px; color: var(--muted); }
.form-actions { display: grid; gap: 8px; }
.stack-form { display: grid; gap: 8px; padding-bottom: 16px; }
.stack-form select { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; outline: none; background: #fff; font-size: 13px; }
.admin-list { padding: 0 20px 18px; display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
.admin-list li { padding-left: 16px; position: relative; }
.admin-list li::before { content: "•"; position: absolute; left: 2px; color: var(--red); font-weight: 900; }

/* ----------------------------------------------------------------- images */
.image-preview { margin: 14px 20px; border: 1px dashed #ddd4c6; background: #fdfaf6; border-radius: 10px; padding: 8px; }
.image-preview img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 7px; }
.image-preview-wide img { aspect-ratio: 16 / 8; }
.gallery-admin { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px 0; }
.gallery-admin-item { position: relative; width: 92px; }
.gallery-admin-item img { width: 92px; height: 92px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.gallery-admin-item .mini-btn { position: absolute; top: -6px; right: -6px; border-radius: 50%; width: 23px; height: 23px; min-width: 23px; padding: 0; font-size: 13px; background: #fff; }
.video-chip { display: flex; width: 92px; height: 92px; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid #3b302a; background: #2a211c; color: #fff; font-size: 22px; }
.inline-add { display: flex; gap: 10px; align-items: flex-end; padding: 14px 20px 20px; flex-wrap: wrap; }
.inline-add .field { flex: 1; min-width: 160px; margin: 0; }
.inline-add .btn { flex: none; }
.detail-rows { display: grid; gap: 0; padding-bottom: 6px; }
.detail-rows > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f8f4ee; font-size: 12.5px; }
.detail-rows > div:last-child { border-bottom: 0; }
.detail-rows span { color: var(--muted); }
.detail-rows strong { text-align: right; color: var(--ink); font-weight: 700; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ login */
.admin-login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(90% 90% at 10% 0%, #f6ede3 0%, #faf6f0 60%, #fdfaf6 100%);
  padding: 24px;
}
.admin-login-shell {
  display: grid; grid-template-columns: 1fr 1fr; width: min(900px, 100%);
  background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 26px 60px rgba(88, 72, 55, .16);
}
.admin-login-aside {
  background: radial-gradient(130% 130% at 10% 0%, #f6ebe1 0%, #faf3ec 55%, #fdf9f4 100%);
  color: var(--ink); padding: 44px 38px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
}
.admin-login-aside h1 { font-size: 26px; margin-top: 18px; }
.admin-login-aside p { color: var(--muted); font-size: 13.5px; }
.admin-login-aside ul { display: grid; gap: 7px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.admin-login-back { margin-top: auto; font-size: 12.5px; color: var(--muted); text-decoration: underline; }
.admin-login-back:hover { color: var(--red-dark); }
.admin-login-form { padding: 42px 40px; display: flex; flex-direction: column; }
.admin-login-form h2 { font-size: 24px; }
.admin-login-form form { display: grid; gap: 12px; margin-top: 14px; }
.admin-login-form .field input { padding: 11px 13px; font-size: 14px; }
.admin-demo { margin-top: 16px; background: #fbf7f3; border: 1px dashed var(--line); border-radius: 9px; padding: 11px 13px; font-size: 11.5px; color: var(--muted); display: grid; gap: 2px; }
.admin-demo strong { color: var(--ink-2); }

/* ------------------------------------------------------------ orders/views */
.order-detail-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
.order-detail-main, .order-detail-side { display: grid; gap: 20px; }
.order-detail-main > .card, .order-detail-side > .card { margin-bottom: 0; }
.order-totals { margin-left: auto; width: 320px; max-width: 100%; padding: 12px 20px 20px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12.5px; color: var(--muted); }
.summary-row strong { color: var(--ink); }
.summary-discount strong { color: var(--green); }
.summary-total { display: flex; justify-content: space-between; gap: 12px; border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 14px; }
.summary-total strong { color: var(--red); font-size: 20px; }
.order-current { font-size: 12.5px; margin-top: 12px; }
.order-customer { margin-top: 12px; }
.danger-zone { border-color: #edd6c9; }
.danger-zone .card-head h2 { color: #87543f; }
.danger-zone form { padding: 12px 20px 18px; }
.admin-hint { margin: 0 20px 16px; }
.detail-rows > div, .order-current, .card > p { }

.customer-detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.customer-detail-grid > .card { margin-bottom: 0; }
.customer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 20px 20px; }
.customer-stats > div { background: #fbf7f3; border-radius: 9px; padding: 11px 12px; display: flex; flex-direction: column; }
.customer-stats span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.customer-stats strong { font-size: 15px; margin-top: 2px; }
.customer-detail-grid .inline-actions { padding: 0 20px 18px; }

/* ------------------------------------------------------------- list panels */
.top-list { padding: 10px 20px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.top-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f9f5ef; min-width: 0; }
.top-item:last-child { border-bottom: 0; }
.top-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f9f5ef; border: 1px solid var(--line); flex: none; }
.top-rank { width: 20px; font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; flex: none; }
.top-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.top-info strong { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-info small { font-size: 10.5px; color: var(--muted); }
.top-amount { font-size: 12px; white-space: nowrap; }
.review-mini-list { padding: 8px 20px 18px; display: grid; gap: 10px; }
.review-mini { background: #fdfaf6; border: 1px solid #f7f2ea; border-radius: 9px; padding: 10px 12px; }
.review-mini-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.review-mini p { margin: 4px 0; font-size: 12px; color: var(--ink-2); }
.review-mini small { font-size: 10.5px; color: var(--muted); }
.stars { color: #e0d8ca; font-size: 13px; letter-spacing: .5px; }
.stars .on { color: #c08f4f; }

.review-admin-list, .message-list, .banner-admin-grid { display: grid; gap: 14px; }
/* Danh sách đánh giá gọn trong form sửa sản phẩm */
.admin-review-mini { display: grid; gap: 10px; padding: 14px 20px 20px; }
.review-mini-row { border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; background: #fdfaf6; }
.review-mini-row > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-mini-row p { margin: 6px 0 8px; font-size: 13px; color: #4a3f36; }
.review-mini-stars { font-size: 12px; color: #ddd4c6; letter-spacing: 1px; }
.review-mini-stars .on { color: #e0a400; }
.review-mini-row .inline-actions { margin: 0; }
.review-admin-card { margin-bottom: 0; padding-bottom: 16px; }
.review-admin-card.is-unread, .message-card.is-unread { border-left: 3px solid var(--red); }
.review-admin-head { display: flex; justify-content: space-between; gap: 14px; padding: 16px 20px 0; flex-wrap: wrap; }
.review-admin-meta { display: flex; align-items: center; gap: 10px; }
.review-admin-comment { margin: 10px 20px 12px !important; font-size: 13px; color: var(--ink-2); }
.review-admin-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 20px; flex-wrap: wrap; }
.message-card { margin-bottom: 0; padding-bottom: 16px; }
.message-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.message-meta { display: flex; align-items: center; gap: 8px; }
.message-subject { margin: 12px 20px 4px !important; font-size: 14px; }
.message-content { margin: 0 20px 12px !important; font-size: 13px; color: var(--ink-2); }
.message-actions { padding: 0 20px; }

.banner-admin-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.banner-admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.banner-admin-thumb { position: relative; }
.banner-admin-thumb img { aspect-ratio: 16 / 8; object-fit: cover; width: 100%; }
.banner-admin-thumb .status { position: absolute; top: 10px; right: 10px; }
.banner-order { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.banner-admin-body { padding: 14px 16px 16px; }
.banner-admin-body h3 { font-size: 14px; margin-bottom: 2px; }
.banner-admin-body p { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.banner-admin-body .inline-actions { margin-top: 10px; }

/* ---------------------------------------------------------------- settings */
.settings-form { display: grid; gap: 20px; }
.settings-form > .card { margin-bottom: 0; }
.settings-actions { display: flex; gap: 10px; align-items: center; }
.profile-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.profile-grid .form-main { display: grid; gap: 16px; }
.profile-grid .card { margin-bottom: 0; }

/* ---------------------------------------------------------------- reports */
.category-report { padding: 8px 20px 20px; display: grid; gap: 14px; }
.category-report-row { display: flex; flex-direction: column; gap: 4px; }
.category-report-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.category-report-head strong { font-size: 12.5px; }
.category-report .progress { margin-top: 2px; }

/* ------------------------------------------------------------------ toast */
.toast-stack { position: fixed; right: 20px; bottom: 22px; z-index: 200; display: grid; gap: 8px; max-width: 340px; }
.toast { background: var(--ink); color: #fff; padding: 11px 15px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; font-weight: 600; animation: toast-in .22s ease; }
.toast.error { background: #9c6450; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.empty-inline { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ live traffic */
.nav-live {
  margin-left: auto; background: #e7f2ea; color: #3f6b4d; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav-live.is-hot { background: #f6e7df; color: var(--red-dark); }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  background: var(--green-soft); color: #3f6b4d; font-size: 12.5px; font-weight: 700;
  border: 1px solid #d8e7dd;
}
.live-pill i {
  width: 8px; height: 8px; border-radius: 50%; background: #5f9b74; display: inline-block;
  box-shadow: 0 0 0 3px rgba(95, 155, 116, .18); animation: live-pulse 1.8s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(95, 155, 116, .16); opacity: 1; }
  50% { box-shadow: 0 0 0 6px rgba(95, 155, 116, .05); opacity: .7; }
}
.live-stamp { font-size: 11.5px; color: var(--muted); }
.visitor-name { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.visitor-dot { width: 7px; height: 7px; border-radius: 50%; background: #c3b6a4; flex: none; }
.visitor-dot.is-user { background: #5f9b74; }
.path-chip {
  display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; background: #f8f4ee; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; font-size: 11.5px; color: var(--ink-2);
}
.rank-list { padding: 6px 20px 18px; display: grid; gap: 2px; }
.rank-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f8f4ee; font-size: 12.5px; min-width: 0;
}
.rank-row:last-child { border-bottom: 0; }
.rank-index {
  width: 20px; height: 20px; border-radius: 6px; background: #f8f4ee; color: var(--muted);
  font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.rank-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .path-chip { flex: 1; max-width: none; }
.rank-value { margin-left: auto; font-weight: 800; color: var(--ink); flex: none; }
.activity-feed { list-style: none; margin: 0; padding: 6px 20px 18px; display: grid; gap: 9px; max-height: 380px; overflow-y: auto; }
.activity-item { display: flex; gap: 10px; align-items: flex-start; }
.activity-kind {
  flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 6px; padding: 3px 7px; margin-top: 1px; background: var(--blue-soft); color: var(--blue);
}
.activity-kind.kind-client { background: var(--red-soft); color: var(--red-dark); }
.activity-kind.kind-action { background: var(--amber-soft); color: var(--amber); }
.activity-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.activity-body strong { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.activity-body small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.live-card { margin-bottom: 20px; }
.live-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0 22px; padding-top: 4px; }
.live-grid h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  padding: 10px 20px 0; margin: 0;
}
.live-grid .activity-feed, .live-grid .rank-list { max-height: 240px; }
.traffic-note { margin-top: 16px; text-align: center; }

/* ------------------------------------------------------- product import */
.import-drop {
  margin: 16px 20px 0; padding: 22px; border: 1.5px dashed var(--line);
  border-radius: 11px; background: #fdfaf6; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.import-drop svg { color: var(--red); }
.import-drop strong { font-size: 13.5px; }
.import-drop small { font-size: 11.5px; color: var(--muted); }
.import-drop input[type="file"] {
  margin-top: 10px; font-size: 12.5px; max-width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
.import-notes { margin: 0; padding: 10px 20px 20px 38px; display: grid; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.import-notes li { line-height: 1.6; }
.import-notes code {
  background: #f8f4ee; border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: 11.5px;
}
.import-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px 20px; }
.import-stat {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; background: #fdfaf6;
}
.import-stat span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.import-stat strong { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.import-stat.is-new { background: var(--green-soft); border-color: #d8e7dd; }
.import-stat.is-new strong { color: #46654f; }
.import-stat.is-edit { background: var(--blue-soft); border-color: #dbe4ec; }
.import-stat.is-edit strong { color: var(--blue); }
.import-stat.is-skip { background: var(--amber-soft); border-color: #ecdfc7; }
.import-stat.is-skip strong { color: var(--amber); }
.import-result { margin-bottom: 20px; }
.table-compact th, .table-compact td { padding: 8px 12px; font-size: 12px; }
.table-compact code { font-size: 11px; }

@media (max-width: 1200px) {
  .live-grid { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .admin-grid-2, .order-detail-grid, .customer-detail-grid, .profile-grid { grid-template-columns: 1fr; }
  .form-layout { grid-template-columns: 1fr 300px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 60px rgba(0, 0, 0, .3); }
  body.admin-nav-open .admin-sidebar { transform: none; }
  .admin-main { margin-left: 0; }
  .admin-menu-btn { display: inline-flex; }
  .admin-topbar { padding: 0 16px; }
  .admin-content { padding: 20px 16px; }
  .admin-flash-wrap { padding: 14px 16px 0; }
  .admin-footer { padding: 0 16px 22px; }
  .form-layout { grid-template-columns: 1fr; }
  .form-side { grid-template-columns: 1fr 1fr; align-items: start; }
  .form-side .form-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  h1 { font-size: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .admin-page-head { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-side { grid-template-columns: 1fr; }
  .admin-user-info { display: none; }
  .admin-login-shell { grid-template-columns: 1fr; }
  .admin-login-aside { display: none; }
  .admin-login-form { padding: 30px 24px; }
  .quick-actions { grid-template-columns: 1fr; }
  .chart-bars { gap: 4px; }
  .chart-label { display: none; }
  .filter-bar input[type="search"] { max-width: none; }
  .customer-stats { grid-template-columns: 1fr; }
  .order-totals { width: 100%; }
  .td-actions { flex-wrap: wrap; }
  .chart-value { display: none; }
  .chart { padding: 14px 12px 6px; }
  .chart-bars { height: 200px; }
}

.order-billing { margin: 10px 0 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-billing p { margin: 2px 0; font-size: 12.5px; }

/* ------------------------------------------------------ QR upload (settings) */
.qr-upload {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
  padding: 16px 20px 20px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}
/* Ảnh thanh toán thường là ảnh dọc: giữ đúng tỉ lệ thay vì ép vào ô vuông. */
.qr-upload-preview {
  width: 280px; max-width: 100%; min-height: 140px;
  border-radius: 10px;
  border: 1px dashed #ddd4c6; background: #fdfaf6;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qr-upload-preview img {
  display: block; width: 100%; height: auto; max-height: 380px;
  object-fit: contain; padding: 5px; background: #fff;
}
.qr-upload-preview a { display: block; line-height: 0; }
.qr-upload-preview a:hover img { outline: 2px solid var(--red, #b45309); outline-offset: -2px; }
.qr-empty { font-size: 11px; color: var(--muted); }
.qr-upload-fields { display: grid; gap: 10px; }
.qr-upload-fields .field input[type="file"] { padding: 7px; font-size: 12px; background: #fdfaf6; }
.qr-upload-fields .switch-row { padding: 6px 0 0; border-top: 0; }
.qr-upload-fields .switch-row strong { color: #87543f; }

@media (max-width: 760px) {
  .qr-upload { grid-template-columns: 1fr; }
  .qr-upload-preview { width: 100%; min-height: 160px; }
  .qr-upload-preview img { max-height: 340px; }
}

.proof-box { margin: 10px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.proof-box img {
  width: 100%; max-width: 260px; border-radius: 9px;
  border: 1px solid var(--line); background: #fdfaf6;
}
.proof-box a:hover img { border-color: var(--red); }
