@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #07090d;
  --bg-elevated: #0c1018;
  --surface: #111822;
  --surface2: #161d2a;
  --surface3: #1c2635;
  --border: #2a3649;
  --border-strong: #3d4f66;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --muted2: #64748b;
  --accent: #2ee6be;
  --accent-mid: #14b897;
  --accent-dim: rgba(46, 230, 190, 0.1);
  --accent-glow: rgba(46, 230, 190, 0.22);
  --danger: #fb7185;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar-w: 260px;
  --top-safe: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body.admin-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(ellipse 100% 80% at 100% -20%, rgba(46, 230, 190, 0.07), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 120%, rgba(59, 130, 246, 0.05), transparent 45%),
    var(--bg);
}

body:not(.admin-body) {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, rgba(46, 230, 190, 0.1), transparent 48%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(59, 130, 246, 0.06), transparent 42%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: #7efce3;
}

/* —— App shell: sidebar + main —— */
.admin-app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.9rem 1rem;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(7, 9, 13, 0.96) 100%);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 1.1rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius);
  color: var(--text) !important;
  text-decoration: none !important;
}

.sidebar-brand:hover {
  background: var(--surface2);
}

.sidebar-brand__mark {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  box-shadow: 0 4px 20px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-brand__text {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar-brand__text small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none !important;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-item[aria-current="page"] {
  color: #031510;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 16px var(--accent-glow);
}

.nav-item__ico {
  width: 1.35rem;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.9;
}

.nav-item[aria-current="page"] .nav-item__ico {
  opacity: 1;
}

.sidebar-spacer {
  flex: 1;
  min-height: 1rem;
}

.sidebar-logout {
  margin: 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.btn-logout {
  padding: 0.48rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-logout--block {
  width: 100%;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.06);
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.35rem 2.5rem;
  width: 100%;
}

.wrap-main {
  flex: 1;
}

.admin-footer {
  margin-top: auto;
  padding: 0.85rem 1.35rem 1.1rem;
  border-top: 1px solid var(--border);
  background: rgba(7, 9, 13, 0.65);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  color: var(--muted2);
  line-height: 1.45;
}

.admin-footer code {
  font-size: 0.85em;
}

@media (max-width: 880px) {
  .admin-app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-brand {
    padding: 0.25rem 0.4rem 0.25rem 0;
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 100%;
    order: 3;
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(42, 54, 73, 0.6);
    margin-top: 0.35rem;
  }

  .nav-item {
    padding: 0.42rem 0.65rem;
    font-size: 0.86rem;
  }

  .nav-item__ico {
    display: none;
  }

  .sidebar-spacer {
    display: none;
  }

  .sidebar-logout {
    border-top: none;
    padding-top: 0;
    margin-left: auto;
    order: 2;
  }

  .btn-logout--block {
    width: auto;
  }
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
  max-width: 52ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card-elevated {
  border-color: rgba(46, 230, 190, 0.12);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, var(--surface) 0%, rgba(17, 24, 34, 0.92) 100%);
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.page-head {
  margin-bottom: 1.35rem;
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.sub-tight {
  margin: 0;
  max-width: 56ch;
}

.table-card {
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.data-table thead th {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.data-table tbody td {
  padding: 0.72rem 0.9rem;
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.stock-pill--ok {
  background: rgba(46, 230, 190, 0.12);
  color: #5eecc8;
  border: 1px solid rgba(46, 230, 190, 0.35);
}

.stock-pill--empty {
  background: rgba(255, 100, 90, 0.12);
  color: #ff8a80;
  border: 1px solid rgba(255, 100, 90, 0.35);
}

.stock-pill--none {
  background: rgba(140, 150, 170, 0.1);
  color: var(--muted);
  border: 1px solid rgba(140, 150, 170, 0.25);
  font-weight: 500;
}

.stock-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.stock-label {
  font-weight: 500;
  opacity: 0.92;
}

.stock-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 5.5rem;
}

.stock-sold {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hint-inline {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: normal;
  max-width: 9rem;
  display: inline-block;
  vertical-align: middle;
  line-height: 1.35;
}

.inline-stock {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  vertical-align: middle;
}

.inventory-card {
  margin-top: 0.25rem;
}

.inventory-card .hint-block {
  margin-bottom: 1rem;
  max-width: none;
}

.inv-stats-bar {
  margin: 1rem 0 0.85rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.inv-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.inv-block--danger {
  border-color: rgba(255, 120, 80, 0.35);
  background: rgba(255, 90, 60, 0.04);
}

.inv-block-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.inv-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.inv-tile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.inv-tile:hover {
  border-color: rgba(46, 230, 190, 0.45);
}

.inv-tile.is-active {
  border-color: rgba(46, 230, 190, 0.65);
  box-shadow: 0 0 0 1px rgba(46, 230, 190, 0.2);
}

.inv-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 8px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.inv-tile-icon--doc {
  background: rgba(255, 90, 90, 0.15);
}
.inv-tile-icon--folder {
  background: rgba(160, 100, 255, 0.15);
}
.inv-tile-icon--file {
  background: rgba(80, 160, 255, 0.15);
}
.inv-tile-icon--code {
  background: rgba(255, 180, 60, 0.15);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.inv-panel {
  margin-top: 0.25rem;
}

.inv-panel[hidden] {
  display: none !important;
}

.inv-action-btn {
  margin-top: 0.75rem;
}

.inv-api-snippet {
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 10rem;
  overflow: auto;
}

.inv-danger-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.inv-danger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.85rem 0.65rem;
  border: none;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.inv-danger-btn:hover {
  filter: brightness(1.06);
}

.inv-danger-btn--multi {
  background: linear-gradient(135deg, #ff8c42, #ff6b35);
}

.inv-danger-btn--all {
  background: linear-gradient(135deg, #ff6b35, #a855f7);
}

.inv-danger-submit {
  margin-top: 0.75rem;
  background: linear-gradient(135deg, #ff6b35, #e84a5f);
  color: #fff;
  border: none;
}

.inv-danger-submit:hover {
  filter: brightness(1.05);
}

.inv-block--list {
  margin-top: 1rem;
}

.inv-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.inv-block-title--row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.inv-list-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(46, 230, 190, 0.15);
  color: var(--accent);
  border: 1px solid rgba(46, 230, 190, 0.35);
}

.inv-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.inv-search {
  min-width: 10rem;
  max-width: 14rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}

.inv-per-page {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.inv-per-page select {
  width: auto;
  min-width: 4rem;
  padding: 0.35rem 0.5rem;
}

.inv-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.inv-lines-table {
  margin: 0;
  font-size: 0.84rem;
}

.inv-lines-table th,
.inv-lines-table td {
  vertical-align: middle;
}

.inv-col-check {
  width: 2.25rem;
  text-align: center;
}

.inv-select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(46, 230, 190, 0.08);
  border: 1px solid rgba(46, 230, 190, 0.22);
  font-size: 0.86rem;
  color: var(--muted);
}

.inv-select-bar[hidden] {
  display: none !important;
}

#inv-select-all-matching {
  color: var(--accent);
  font-weight: 600;
}

.inv-col-user {
  width: 9rem;
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: var(--accent);
}

.inv-col-id {
  width: 4.5rem;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.inv-col-time {
  width: 10.5rem;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.inv-col-act {
  width: 4.5rem;
  text-align: right;
}

.inv-line-cell {
  max-width: 0;
  width: 40%;
}

.inv-line-text {
  display: block;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.4;
  word-break: break-all;
  white-space: pre-wrap;
  max-height: 4.2rem;
  overflow: auto;
  padding: 0.15rem 0;
  color: var(--text);
  background: transparent;
}

.inv-list-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.inv-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.inv-clear-link {
  color: var(--danger) !important;
}

.inv-pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inv-page-info {
  font-size: 0.82rem;
  color: var(--muted);
}

.inv-page-btns {
  display: flex;
  gap: 0.25rem;
}

.inv-table-wrap--page {
  max-height: min(560px, calc(100vh - 18rem));
}

.inv-block--page {
  border: none;
  padding: 0;
  background: transparent;
}

.inventory-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.inv-product-picker {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  min-width: min(100%, 20rem);
}

.inv-product-select {
  min-width: 16rem;
  max-width: 28rem;
}

.inventory-page-card {
  padding: 1rem 1.1rem 1.1rem;
}

.inv-manage-link {
  font-weight: 600;
}

.mono-input {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 11rem;
}

.btn-primary {
  margin-top: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: rgba(46, 230, 190, 0.06);
}

tbody tr:last-child td {
  border-bottom: none;
}

td.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  white-space: nowrap;
}

.actions form {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

/* Chống margin-top bị kế thừa từ button[type="submit"] global */
.actions button,
.actions .btn,
.actions input,
.actions form button,
.actions form .btn {
  margin-top: 0 !important;
}

.inp-inline {
  width: 5.5rem;
  max-width: 6rem;
  margin: 0;
  display: inline-block;
  vertical-align: middle;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-on {
  background: rgba(46, 230, 190, 0.14);
  color: var(--accent);
}

.badge-off {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

label {
  display: block;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
}

label:first-of-type {
  margin-top: 0;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 230, 190, 0.18);
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

button[type="submit"],
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1.2rem;
  margin-top: 1.1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-mid) 100%);
  color: #031510;
  box-shadow: 0 2px 16px var(--accent-glow);
  transition: filter 0.15s, transform 0.1s;
}

.page-head .btn-primary,
.products-toolbar .btn-primary {
  margin-top: 0;
}

button[type="submit"]:hover,
.btn:hover {
  filter: brightness(1.06);
}

button[type="submit"]:active,
.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 0.38rem 0.7rem;
  font-size: 0.8rem;
  margin-top: 0;
  border-radius: 7px;
}

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-ghost:hover {
  filter: brightness(1.08);
  border-color: var(--muted);
}

/* .inp-inline đã định nghĩa ở .actions block trên */

.form-grid {
  display: grid;
  gap: 0 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 880px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 9px;
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
}

.alert-err {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.alert-ok {
  background: rgba(46, 230, 190, 0.08);
  border: 1px solid rgba(46, 230, 190, 0.28);
  color: var(--accent);
}

.msg {
  color: #fecaca;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  max-width: 48ch;
}

.hint-block {
  max-width: none;
  margin-bottom: 0.5rem;
}

hr.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.dash-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 960px) {
  .dash-grid--wide {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.kpi-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.35rem;
}

@media (min-width: 720px) {
  .kpi-grid--compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid rgba(42, 54, 73, 0.85);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  border-color: rgba(46, 230, 190, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.kpi-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.chart-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 920px) {
  .chart-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

.chart-card .card-title {
  margin-bottom: 0.75rem;
}

.chart-canvas-wrap {
  height: 280px;
  position: relative;
}

.chart-canvas-wrap--pie {
  height: 300px;
}

.dash-tile {
  display: block;
  padding: 1.4rem 1.45rem;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text) !important;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}

.dash-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(46, 230, 190, 0.45);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  text-decoration: none !important;
}

.dash-tile strong {
  display: block;
  font-size: 1.08rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.dash-tile span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--surface2);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

body.login-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  min-height: 100vh;
  min-height: 100dvh;
}

.login-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 28%, rgba(46, 230, 190, 0.14), transparent 38%),
    radial-gradient(circle at 82% 72%, rgba(99, 102, 241, 0.12), transparent 40%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(165deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 2.25rem;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.login-card__badge {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.login-card__title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.login-card__lead {
  margin: 0 0 1.35rem !important;
  max-width: none !important;
}

.login-form label:first-of-type {
  margin-top: 0;
}

.login-submit {
  width: 100%;
  margin-top: 1.35rem !important;
  padding: 0.72rem !important;
}

.products-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.products-toolbar .btn {
  margin-top: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
}

.modal-panel--wide {
  max-width: 640px;
  max-height: min(92vh, 860px);
}

.modal-backdrop.is-open .modal-panel {
  transform: scale(1) translateY(0);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.modal-body {
  padding: 1rem 1.25rem 1.35rem;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 0 1.25rem 1.25rem;
}

.modal-foot .btn,
.modal-foot button {
  margin-top: 0;
}

.row-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.row-check input {
  width: auto;
  max-width: none;
}

.toast-stack {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.28s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-ok {
  background: linear-gradient(145deg, #134e4a, #0d3d38);
  border: 1px solid rgba(46, 230, 190, 0.35);
  color: #b6fff0;
}

.toast-err {
  background: linear-gradient(145deg, #4a1a1a, #301010);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.toast-purchase {
  background: linear-gradient(145deg, #0f2a24, #0a1f1a);
  border: 1px solid rgba(46, 230, 190, 0.4);
  color: var(--text);
}

.toast-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-right: 0.35rem;
}

.toast-sub {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}

.table-wrap--wide {
  overflow-x: auto;
}

.orders-table .order-delivery {
  min-width: 14rem;
  max-width: 22rem;
}

.order-delivery-preview {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  word-break: break-all;
}

.order-delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.order-delivery-detail {
  margin-top: 0.5rem;
}

.order-delivery-text {
  font-size: 0.78rem;
  min-height: 4rem;
  resize: vertical;
}

.order-row--new td {
  animation: order-flash 2.5s ease;
}

@keyframes order-flash {
  0% {
    background: rgba(46, 230, 190, 0.18);
  }
  100% {
    background: transparent;
  }
}

.order-user {
  font-size: 0.82rem;
  color: var(--muted);
}

/* —— Trang có nhiều section (vd /notify) —— */
.stack-prose {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-stack button[type="submit"] {
  margin-top: 1.2rem;
}

.alert-inline {
  margin: 1rem 0 0 !important;
}

.result-lead {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 500;
  line-height: 1.45;
}

.btn-primary-inline {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin-top: 1.1rem;
  text-decoration: none !important;
}

.btn-primary-inline:hover {
  filter: brightness(1.06);
  text-decoration: none !important;
}

.back-link {
  margin-top: 1rem;
}

/* Act hint inside table actions (replaces cramped inline forms) */
.act-hint {
  font-size: 0.75rem;
  color: var(--muted2);
  white-space: nowrap;
  font-style: italic;
}

/* User modal extras */
.modal-title-flex {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 1.15rem;
  margin: 0;
}

.um-username-tag {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(46, 230, 190, 0.2);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
}

/* user-id truncation in table */
.user-id-cell {
  font-size: 0.78rem;
  color: var(--muted);
  cursor: default;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
