/* Nova Đăng Nhóm — giao diện chung.
   Bảng màu theo nhận diện Nova Automation (bản chốt 27/08): nền #FDF6FA, nền phụ #FBE7F1,
   điểm nhấn #E11D8F, chữ #1F1420. Bố cục ứng dụng bám theo fbtool.net để khách từng dùng
   tool đó là dùng được ngay, nhưng màu sắc là của Nova. */

:root {
  --bg: #fdf6fa;
  --bg-alt: #fbe7f1;
  --surface: #ffffff;
  --ink: #1f1420;
  --ink-2: #6b5a67;
  --ink-3: #9a8794;
  --line: #efdce8;
  --line-strong: #e3c6d9;
  --accent: #e11d8f;
  --accent-ink: #a8146b;
  --accent-soft: #fce9f4;
  --ok: #0e7a57;
  --ok-soft: #e4f5ee;
  --warn: #8f5b00;
  --warn-soft: #fbf0da;
  --risk: #b01f34;
  --risk-soft: #fbe7ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 20, 32, 0.05), 0 8px 24px -12px rgba(31, 20, 32, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 12px; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); letter-spacing: -0.015em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: 0.02em; }
.brand svg { width: 20px; height: 20px; color: var(--accent); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fdf6fa; border: 0; border-radius: 9px;
  padding: 11px 18px; font-family: inherit; font-size: 0.94rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent-ink); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 7px 13px; font-size: 0.85rem; }
.btn.danger { background: var(--risk); }
.btn.block { width: 100%; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%; font-family: inherit; font-size: 0.94rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

.pill { display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.risk { background: var(--risk-soft); color: var(--risk); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

.alert { border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; border: 1px solid; font-size: 0.9rem; }
.alert.err { background: var(--risk-soft); border-color: var(--risk); color: var(--risk); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert:empty { display: none; }

.muted { color: var(--ink-3); font-size: 0.85rem; }
.hidden { display: none !important; }

/* ---------- Trang giới thiệu & trang rủi ro ---------- */

.page { max-width: 940px; margin: 0 auto; padding: 40px 22px 80px; }
.page.narrow { max-width: 660px; }

.hero { padding: 30px 0 20px; }
.hero p.sub { font-size: 1.08rem; color: var(--ink-2); max-width: 54ch; }

.plans { display: grid; gap: 14px; margin: 26px 0; }
@media (min-width: 720px) { .plans { grid-template-columns: 1fr 1fr; } }
.plan .price { font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.plan .price small { font-size: 0.8rem; font-weight: 500; color: var(--ink-3); }
.plan ul { margin: 12px 0 0; padding-left: 18px; font-size: 0.9rem; color: var(--ink-2); }
.plan li { margin-bottom: 5px; }
.plan li::marker { color: var(--accent); }

.google-btn {
  display: inline-flex; align-items: center; gap: 10px; width: 100%; justify-content: center;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 12px 18px; font-weight: 600; font-size: 0.95rem;
  text-decoration: none; cursor: pointer;
}
.google-btn:hover { background: var(--bg-alt); }
.google-btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Ứng dụng ---------- */

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .grow { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; }
.topbar .who img { width: 28px; height: 28px; border-radius: 50%; }

.shell { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 50px); }
@media (min-width: 1000px) { .shell { grid-template-columns: 56px 1fr 1fr; } }

.rail { display: none; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; background: var(--surface); border-right: 1px solid var(--line); }
@media (min-width: 1000px) { .rail { display: flex; } }
.rail button {
  width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-3); cursor: pointer; font-size: 1.05rem; display: grid; place-items: center;
}
.rail button.on { background: var(--accent-soft); color: var(--accent-ink); }
.rail button:hover { background: var(--bg-alt); }

.pane { padding: 18px; border-bottom: 1px solid var(--line); min-width: 0; }
@media (min-width: 1000px) { .pane { border-bottom: 0; overflow-y: auto; max-height: calc(100vh - 50px); } .pane.left { border-right: 1px solid var(--line); } }

.pane-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pane-head h2 { margin: 0; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; padding-bottom: 1px; }
.tabs button {
  border: 0; background: transparent; color: var(--ink-3); font-family: inherit;
  font-size: 0.82rem; font-weight: 600; padding: 6px 11px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabs button.filled::after { content: "•"; color: var(--accent); margin-left: 4px; }

.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; font-size: 0.9rem; }
.switch input { display: none; }
.switch .track { width: 34px; height: 19px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background 0.15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 17px; }

.dropzone { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 18px; text-align: center; color: var(--ink-3); font-size: 0.85rem; cursor: pointer; background: var(--bg); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs figure { position: relative; margin: 0; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); display: block; }
.thumbs button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--risk); color: #fff; cursor: pointer; font-size: 0.7rem; line-height: 1; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.grid th { text-align: left; font-size: 0.65rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr.off { opacity: 0.55; }
.gname { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.history-item { border-bottom: 1px solid var(--line); padding: 11px 0; font-size: 0.86rem; }
.history-item:last-child { border-bottom: 0; }
.history-item .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.history-item .err { color: var(--risk); font-size: 0.8rem; margin-top: 4px; }

.modal-bg { position: fixed; inset: 0; background: rgba(31, 20, 32, 0.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; padding: 24px; max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow); }

.steps { counter-reset: s; padding-left: 0; list-style: none; margin: 12px 0; }
.steps li { counter-increment: s; position: relative; padding-left: 30px; margin-bottom: 10px; font-size: 0.88rem; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 0.72rem; font-weight: 700; display: grid; place-items: center;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Ngưỡng bài/ngày bị vượt — chữ đổi màu để khách thấy ngay, không phải lỗi nên không dùng màu đỏ báo lỗi. */
.canh-bao { color: #B54708; font-weight: 600; }
