/* Nền tảng chung cho trang khách và trang quản trị */
:root {
  --primary: #0B5C7A;
  --primary-dark: #08465D;
  --accent: #F29A2E;
  --store: var(--primary);
  --ink: #1B2430;
  --ink-2: #4A5565;
  --line: #E2E7ED;
  --bg: #FFFFFF;
  --bg-2: #F5F7FA;
  --ok: #1E7F4F;
  --warn: #B26A00;
  --err: #C0352B;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .62em 1.1em; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { border-color: #c5ced8; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1b1300; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.sm { min-height: 32px; padding: .3em .7em; font-size: .875rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; padding: .3em .5em; border-radius: 8px; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg-2); }

label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 .3em; }
input, select, textarea { width: 100%; font: inherit; padding: .6em .75em; border: 1px solid #cdd5df; border-radius: 10px; background: #fff; color: var(--ink); min-height: 42px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent); outline-offset: 1px; border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
.field { margin-bottom: 1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; gap: .5em; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .3em; }

.badge { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: #E3F4EA; color: var(--ok); }
.badge.warn { background: #FFF1DC; color: var(--warn); }
.badge.err { background: #FDE7E5; color: var(--err); }
.badge.info { background: #E3F0F6; color: var(--primary); }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: .7em 1em; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.err { background: var(--err); }
.toast.warn { background: var(--warn); }

.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 900; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55em .7em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); font-weight: 600; background: var(--bg-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table-wrap table th:first-child, .table-wrap table td:first-child { padding-left: 1em; }

.demo-banner { background: #FFF6E5; color: #6B4A00; font-size: .85rem; text-align: center; padding: .4em 1em; }
.demo-banner a { color: inherit; font-weight: 600; }

@media print {
  .no-print, header, nav, footer, .demo-banner, #toasts { display: none !important; }
}
