/* Kiểu dùng chung */
:root {
  --accent: #1e0e7f;
  --accent-ink: #fff;
  --green: #17803d;
  --bg: #fbf6f6;
  --card: #ffffff;
  --ink: #1d1c1a;
  --muted: #6f6b66;
  --line: #e6e2dd;
  --soft: #f3ecec;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(20, 15, 10, 0.12);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
:root.dark {
  --bg: #121212;
  --card: #1c1c1c;
  --ink: #f1efec;
  --muted: #a39f99;
  --line: #2e2c2a;
  --soft: #262523;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: var(--ink); }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.gap { gap: 8px; }
.row.gap2 { gap: 14px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt2 { margin-top: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s, opacity .15s; text-decoration: none;
}
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: #c62828; border-color: #c62828; color: #fff; }
.btn.ghost { background: transparent; }
.btn.dark { background: #1d1c1a; color: #fff; border-color: #1d1c1a; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 12px 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }
.btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); }
.textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #c9c4be; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { opacity: .7; font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--soft); }
.badge.green { background: #e3f4e8; color: #17803d; }
.badge.red { background: #fde8ea; color: #b3122e; }
.badge.amber { background: #fff3d6; color: #8a5a00; }
.badge.gray { background: var(--soft); color: var(--muted); }

.modal-wrap {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15, 12, 10, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s;
}
.modal-card {
  background: var(--card); color: var(--ink); border-radius: 18px; width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: var(--shadow); animation: pop .18s;
}
.modal-card.wide { max-width: 720px; }
.modal-card h3 { margin: 0 0 10px; font-size: 18px; }
.modal-card .x { float: right; border: none; background: none; cursor: pointer; padding: 4px; margin: -6px -6px 0 0; color: var(--muted); }
.confirm-msg { margin: 0 0 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); z-index: 3000;
  background: #1d1c1a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: #b3122e; }
.toast.ok { background: #17803d; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.strokes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wm { position: absolute; inset: 0; pointer-events: none; background-repeat: repeat; }
img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
