/* Hải Tặc Admin — tông xanh biển + trắng. */
:root {
  --accent: #0369a1;
  --accent-dark: #075985;
  --accent-soft: #e0f2fe;
  --accent-faint: #f0f9ff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #dbe7f0;
  --white: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 1px 2px rgba(12, 74, 110, 0.06), 0 4px 16px rgba(12, 74, 110, 0.06);
  --radius: 12px;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--accent-faint); color: var(--text); font-size: 14px; }
a { color: var(--accent-dark); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* Khung */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff;
  display: grid; place-items: center; font-weight: 800; }
.brand b { font-size: 16px; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 9px 12px; border-radius: 9px; color: var(--text); display: flex; gap: 10px; align-items: center; }
.nav a:hover { background: var(--accent-faint); text-decoration: none; }
.nav a.on { background: var(--accent); color: #fff; font-weight: 600; }
.nav .group { margin: 12px 12px 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.side .me { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.side .me small { color: var(--muted); }
.main { padding: 22px 26px 40px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.top h1 { font-size: 20px; margin: 0; }
.top .sp { flex: 1; }

/* Thành phần */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .sp { flex: 1; }
.grid { display: grid; gap: 14px; }
.main > .grid { margin-bottom: 16px; }
.g4 { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 24px; font-weight: 700; color: var(--accent-dark); }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
button, .btn { font: inherit; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 9px; padding: 7px 14px;
  cursor: pointer; font-weight: 600; }
button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.ghost { background: var(--white); color: var(--accent-dark); }
button.ghost:hover { background: var(--accent-faint); }
button.danger { background: var(--red); border-color: var(--red); }
button.sm { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid #c9dbe8; border-radius: 9px; padding: 7px 10px; background: #fff; color: var(--text); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.f > span { font-weight: 600; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 200px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--accent-faint); }
td { padding: 7px 8px; border-bottom: 1px solid #eaf1f6; vertical-align: top; }
tr:hover td { background: #f5fbff; }
.tablewrap { overflow: auto; max-height: 560px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-dark); }
.pill.ok { background: #dcfce7; color: var(--green); }
.pill.bad { background: #fee2e2; color: var(--red); }
.pill.gray { background: #f3f4f6; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; font-size: 12px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a.on { color: var(--accent-dark); border-color: var(--accent); font-weight: 600; }
.note { background: var(--accent-faint); border: 1px dashed #7dd3fc; border-radius: 10px; padding: 10px 12px; color: #0c4a6e; margin-bottom: 12px; }
.warn { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; }
.kv div:nth-child(odd) { color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bars .b { flex: 1; background: linear-gradient(180deg, #7dd3fc, var(--accent)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover { background: var(--accent-dark); }
.empty { color: var(--muted); padding: 10px 0; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; z-index: 50; }
.toast.err { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(31, 41, 55, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--white); border-radius: 14px; padding: 20px; width: min(520px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Đăng nhập */
.auth { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 60%, #bae6fd 100%); padding: 16px; }
.auth .box { width: min(380px, 100%); background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 10px 40px rgba(3, 105, 161, .15); }
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.auth p { color: var(--muted); margin: 0 0 18px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth input { width: 100%; padding: 10px 12px; }
.auth button { padding: 10px; }
.auth .err { color: var(--red); font-size: 13px; min-height: 18px; }
.auth img.qr { display: block; margin: 8px auto; border: 1px solid var(--line); border-radius: 8px; }

.gamebadge { font-size: 12px; color: var(--muted); white-space: nowrap; }
.env { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; letter-spacing: .04em; }
.env.dev { background: #e0f2fe; color: #075985; }
.env.stg { background: #fef3c7; color: #92400e; }
.env.prod { background: #fee2e2; color: #b91c1c; }
input.qs { width: 170px; padding: 5px 9px; font-size: 13px; }
pre.json { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 11px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
tr.click { cursor: pointer; }
a.btn { display: inline-block; }
.relaxed { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; font-weight: 600; font-size: 13px; }

/* Hỗ trợ khách hàng */
.split { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.tlist { display: flex; flex-direction: column; max-height: calc(100vh - 210px); overflow: auto; }
.tlist a.t { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.tlist a.t:hover { background: var(--accent-faint); text-decoration: none; }
.tlist a.t.on { background: var(--accent-soft); }
.tlist .t .l1 { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.tlist .t .l1 .sp { flex: 1; }
.tlist .t .l2 { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; padding: 4px 2px 8px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg.player { align-self: flex-start; background: #f1f5f9; }
.msg.admin { align-self: flex-end; background: var(--accent-soft); }
.msg.ai { align-self: flex-end; background: #ecfdf5; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 12px; }
.notes .n { border-left: 3px solid #fbbf24; padding: 4px 10px; margin: 6px 0; background: #fffbeb; border-radius: 0 8px 8px 0; }
.perm-group { margin: 8px 0 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; margin-left: auto; font-weight: 700; }

@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .tlist { max-height: 320px; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .group { display: none; }
  .side .me { margin-top: 0; padding: 8px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
  .main { padding: 16px; }
}

/* Sổ nhiệm vụ (18/11/2026): mở sẵn, ô theo dõi + hộp thoại giống game. */
.qb-chapter { margin-bottom: 22px; }
.qb-chapter-head { position: sticky; top: 0; z-index: 2; background: var(--accent); color: #fff; padding: 9px 14px; border-radius: var(--radius); margin-bottom: 10px; }
.qb-chapter-head span { opacity: .9; font-size: 13px; }
.qb-quest { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; scroll-margin-top: 52px; }
.qb-quest.qb-flash { outline: 3px solid #f59e0b; }
.qb-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 15px; }
.qb-id { font-family: ui-monospace, monospace; color: var(--muted); }
.qb-meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.qb-body { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .qb-body { grid-template-columns: 1fr; } }
.qb-tracker { background: rgba(10, 20, 35, .86); color: #f8fafc; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.qb-tracker-name { color: #fcd34d; font-weight: 700; margin-bottom: 6px; }
.qb-obj { display: flex; flex-wrap: wrap; gap: 4px; line-height: 1.45; }
.qb-dot { color: #fcd34d; }
.qb-dlg { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fffdf7; }
.qb-dlg-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.qb-line { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 3px 0; }
.qb-line b { color: #9a3412; }
.qb-choice { margin: 3px 0 3px 118px; padding: 3px 8px; border: 1px dashed #d97706; border-radius: 6px; background: #fff7ed; }
.qb-reward { margin-top: 4px; }
.qb-links { margin-top: 8px; font-size: 13px; }
.qb-tech, .qb-tech-pill { display: none; color: var(--muted); font-size: 12px; }
.qb-show-tech .qb-tech { display: inline; }
.qb-show-tech div.qb-tech { display: block; margin-top: 4px; }
.qb-show-tech .qb-tech-pill { display: inline-block; }
.qb-tracker .qb-tech { color: #94a3b8; }

/* ---------------- Website (public/website.js, 19/11/2026) ---------------- */
.modal.wide { width: min(980px, 96vw); max-height: 92vh; overflow: auto; }
.web-savebar { position: sticky; top: 0; z-index: 5; background: var(--bg, #f8fafc); padding: 8px 0; margin-bottom: 8px; align-items: center; }
.web-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.web-fields .wide { grid-column: 1 / -1; }
.web-fields textarea { min-height: 70px; }
label.f.check { flex-direction: row; align-items: center; gap: 8px; }
.web-image { display: flex; gap: 10px; align-items: flex-start; }
.web-image .grow { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.web-thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #0f172a; }
.web-thumb.sm { width: 72px; height: 42px; }
.web-list { display: flex; flex-direction: column; gap: 10px; }
.web-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); }
.web-item-top { align-items: center; margin-bottom: 8px; }
.web-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.web-tile { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--white); cursor: pointer; min-width: 0; }
.web-tile img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; background: #0f172a; }
.web-tile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.web-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); margin-top: 10px; }
.web-drop.drag { border-color: var(--accent); background: var(--accent-faint); }
.web-out { min-height: 18px; margin: 6px 0; white-space: pre-wrap; }
.web-json { white-space: pre-wrap; word-break: break-all; }
a.btn { display: inline-block; text-decoration: none; }
