:root {
  --ink: #12151d;
  --ink-2: #1b2028;
  --paper: #faf8f4;
  --card: #ffffff;
  --text: #1c2129;
  --muted: #7b8494;
  --line: #e9e6df;
  --line-2: #eef0f4;
  --gold: #c2a25c;
  --gold-2: #d9bd7e;
  --gold-deep: #a8863f;
  --gold-rgb: 194, 162, 92;
  --brand: #1d5cff;
  --accent: #2f9e6f;
  --danger: #d0433f;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(24, 30, 50, 0.08);
  --shadow-sm: 0 2px 12px rgba(24, 30, 50, 0.05);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mt8 { margin-top: 8px; }
a { color: inherit; }

/* =================================================================
   TRANG ĐĂNG KÝ — luxury 2 cột
   ================================================================= */
.reg-page { min-height: 100vh; }
.reg-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

/* ---- Cột thương hiệu ---- */
.brand-panel {
  position: relative;
  overflow: hidden;
  color: #f3efe6;
  background:
    radial-gradient(120% 90% at 15% 10%, rgba(var(--gold-rgb),0.20), transparent 42%),
    radial-gradient(90% 80% at 90% 95%, rgba(var(--gold-rgb),0.12), transparent 46%),
    linear-gradient(158deg, #191d27 0%, #0f131a 58%, #0b0e13 100%);
  display: flex;
  align-items: center;
}
.brand-panel::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.brand-content {
  position: relative; z-index: 1;
  padding: 64px 60px;
  width: 100%;
  max-width: 560px;
  margin-left: auto;
}
.brand-top { display: flex; align-items: center; gap: 14px; margin-bottom: 64px; }
.brand-mark {
  font-family: var(--serif); font-weight: 700; font-size: 22px;
  letter-spacing: 1px; color: #fff;
}
.brand-logo { max-height: 46px; max-width: 210px; width: auto; display: block; }
.brand-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); max-width: 60px; }
.brand-kicker { font-size: 11px; letter-spacing: 3px; color: var(--gold-2); font-weight: 600; }

.brand-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(34px, 3.4vw, 52px); line-height: 1.12;
  margin: 0 0 22px; color: #fdfbf6;
}
.brand-desc { color: #c7c9cf; font-size: 16px; max-width: 420px; margin: 0 0 44px; }

.brand-features { list-style: none; padding: 0; margin: 0 0 48px; display: grid; gap: 16px; }
.brand-features li { display: flex; align-items: center; gap: 14px; font-size: 15px; color: #e4e2dd; }
.ft-ico {
  color: var(--gold-2); font-size: 13px;
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border: 1px solid rgba(var(--gold-rgb),0.4); border-radius: 50%;
}
.brand-foot { font-size: 13px; color: #8b8f98; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

/* ---- Cột form ---- */
.form-panel {
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}
.form-inner { width: 100%; max-width: 480px; }

/* ---- Bước chọn vai trò ---- */
.role-choose { width: 100%; max-width: 460px; }
.rc-head { margin-bottom: 30px; }
.rc-head h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 8px; color: var(--ink); }
.rc-head p { color: var(--muted); font-size: 14px; margin: 0; }
.role-btn {
  width: 100%; display: flex; align-items: center; gap: 16px;
  padding: 20px 20px; margin-bottom: 14px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  font-family: inherit; text-align: left;
  transition: border-color .16s, box-shadow .16s, transform .1s;
}
.role-btn:hover { border-color: var(--gold); box-shadow: 0 8px 24px rgba(var(--gold-rgb),.12); transform: translateY(-1px); }
.role-btn:active { transform: translateY(0); }
.role-ico {
  width: 52px; height: 52px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, #f7f1e3, #efe6d0);
}
.role-txt { flex: 1; display: flex; flex-direction: column; }
.role-txt b { font-size: 17px; color: var(--ink); }
.role-txt small { font-size: 13px; color: var(--muted); margin-top: 2px; }
.role-arrow { color: var(--gold); font-size: 20px; }
.rc-foot { text-align: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.rc-foot a { color: var(--muted); text-decoration: none; font-size: 13px; }
.rc-foot a:hover { color: var(--gold-deep); }

.back-role {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--muted); font-size: 13px; font-weight: 600; padding: 0;
  margin-bottom: 14px; display: inline-flex; align-items: center;
}
.back-role:hover { color: var(--gold-deep); }

.form-head { margin-bottom: 30px; }
.form-head h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 8px; color: var(--ink); }
.form-head p { color: var(--muted); font-size: 14px; margin: 0; }

.section-title {
  display: flex; align-items: center; gap: 12px;
  margin: 6px 0 18px; font-family: var(--serif); font-size: 16px;
  font-weight: 600; color: var(--gold-deep);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title + .field, .section-title { margin-top: 4px; }
.form-inner .section-title:not(:first-of-type) { margin-top: 26px; }

.field { margin-bottom: 18px; }
.field > label {
  display: block; font-weight: 600; font-size: 13px;
  letter-spacing: .2px; margin-bottom: 8px; color: #3a4048;
}
.req { color: var(--gold-deep); }
input, select, textarea {
  width: 100%; padding: 13px 15px; font-size: 15px; font-family: inherit;
  color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 11px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: #b3b8c0; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(var(--gold-rgb),0.16);
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 10px 16px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; cursor: pointer; font-size: 14px; color: #3a4048;
  font-family: inherit; transition: all .15s;
}
.chip:hover { border-color: var(--gold); color: var(--gold-deep); }
.chip.active {
  background: linear-gradient(135deg, var(--ink-2), var(--ink));
  border-color: var(--ink); color: #fff;
}

/* ---- Nút cao cấp ---- */
.btn-lux {
  position: relative; width: 100%; margin-top: 8px;
  padding: 15px 24px; border: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: .3px;
  color: #1a1508; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-2) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 8px 22px rgba(var(--gold-rgb),0.28);
  transition: transform .12s, box-shadow .18s, filter .18s;
  overflow: hidden;
}
.btn-lux:hover { filter: brightness(1.04); box-shadow: 0 10px 26px rgba(var(--gold-rgb),0.36); }
.btn-lux:active { transform: translateY(1px); }
.btn-lux:disabled { cursor: default; filter: grayscale(.2) brightness(.98); }
.btn-lux.loading span { visibility: hidden; }
.btn-lux.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(26, 21, 8, .3); border-top-color: #1a1508;
  animation: spin .7s linear infinite;
}
.btn-lux.ghost {
  background: transparent; color: var(--gold-2);
  border: 1px solid rgba(var(--gold-rgb),.5); box-shadow: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg { margin-top: 14px; font-size: 14px; text-align: center; min-height: 20px; }
.msg.ok { color: var(--accent); font-weight: 600; }
.msg.err { color: var(--danger); font-weight: 600; }

.form-bottom { text-align: center; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-bottom a { color: var(--muted); text-decoration: none; font-size: 13px; letter-spacing: .3px; }
.form-bottom a:hover { color: var(--gold-deep); }

/* ---- Màn cảm ơn ---- */
.thanks-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 19, 26, 0.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.thanks-card {
  background: var(--card); border-radius: 22px; padding: 44px 38px;
  max-width: 420px; text-align: center; box-shadow: var(--shadow);
  animation: pop .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.thanks-icon {
  width: 68px; height: 68px; margin: 0 auto 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; color: #fff;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-deep));
  box-shadow: 0 8px 22px rgba(var(--gold-rgb),.35);
}
.thanks-card h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 12px; color: var(--ink); }
.thanks-card p { color: var(--muted); font-size: 15px; margin: 0 0 26px; }

/* =================================================================
   ADMIN
   ================================================================= */
.wrap { max-width: 620px; margin: 0 auto; padding: 24px 16px 48px; }
.card {
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 22px; margin-bottom: 18px;
}
.logo {
  display: inline-block; font-family: var(--serif); font-weight: 700;
  letter-spacing: .5px; color: var(--ink); font-size: 20px;
}
.logo .accent-dot { color: var(--gold); }
.center { display: block; width: fit-content; margin: 0 auto 8px; }

/* Login */
.login { max-width: 400px; padding-top: 8vh; }
.login h2 { text-align: center; font-family: var(--serif); font-weight: 600; margin: 0 0 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 15px;
  padding: 13px 20px; border-radius: 11px; text-decoration: none; transition: all .15s;
}
.btn.primary {
  width: 100%; color: #1a1508;
  background: linear-gradient(135deg, var(--gold-2), var(--gold), var(--gold-deep));
  box-shadow: 0 6px 18px rgba(var(--gold-rgb),.25);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn.small { padding: 9px 15px; font-size: 14px; width: auto; box-shadow: none; }
.btn.danger-ghost { background: #fff; border: 1px solid #f0d3d2; color: var(--danger); }

.dash { max-width: 1180px; margin: 0 auto; padding: 18px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 4px 20px; flex-wrap: wrap; gap: 12px;
}
.topbar .logo { font-size: 19px; }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.nav-tab {
  background: transparent; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 14px; border-radius: 9px;
}
.nav-tab.active { background: var(--ink); color: #fff; }
.nav-link { color: var(--gold-deep); text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 10px; }

.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; padding: 16px 18px; }
.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group.grow { flex: 1; }
.control-group > label { font-size: 11px; letter-spacing: .4px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.control-group select, .control-group input[type=date] { width: auto; padding: 9px 12px; }
#customRange { flex-direction: row; align-items: flex-end; gap: 8px; }

.period-tabs { display: flex; gap: 4px; background: #f0ede6; padding: 4px; border-radius: 11px; }
.ptab {
  border: none; background: transparent; padding: 8px 15px; border-radius: 8px;
  cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
}
.ptab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.08); }

.range-label { color: var(--muted); font-size: 13px; margin: 2px 6px 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.kpi.accent { background: linear-gradient(140deg, var(--ink-2), var(--ink)); border: none; color: #fff; position: relative; overflow: hidden; }
.kpi.accent::after { content: ""; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--gold-rgb),.35), transparent 70%); }
.kpi-val { font-size: 26px; font-weight: 800; font-family: var(--serif); }
.kpi.accent .kpi-val { color: var(--gold-2); }
.kpi-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.accent .kpi-label { color: rgba(255,255,255,.8); }
.kpi-small { font-size: 12px; color: var(--muted); margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card h3 { margin: 0 0 16px; font-size: 15px; font-weight: 700; color: var(--ink); }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 34px; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: #f0ede6; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-2)); border-radius: 6px; }
.bar-val { font-size: 13px; font-weight: 700; text-align: right; }

.trend { display: flex; align-items: flex-end; gap: 6px; height: 160px; overflow-x: auto; padding-top: 10px; }
.tcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 26px; height: 100%; }
.tbar { width: 62%; background: linear-gradient(180deg, var(--gold-2), var(--gold-deep)); border-radius: 5px 5px 0 0; }
.tlabel { font-size: 10px; color: var(--muted); margin-top: 6px; transform: rotate(-45deg); white-space: nowrap; }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.list-head h3 { margin: 0; }
.search { max-width: 320px; padding: 9px 13px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line-2); }
th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.nowrap { white-space: nowrap; }
tbody tr:hover { background: #faf9f6; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.kh { background: #eaf2ff; color: #1c5bd8; }
.badge.biz { background: #fff2dd; color: var(--gold-deep); }

/* ---- Cài đặt ---- */
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.set-card h3 { display: flex; align-items: center; gap: 8px; }
.set-card .hint { font-size: 12px; color: var(--muted); margin: -8px 0 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; min-height: 34px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 8px 7px 10px; background: #f7f4ee; border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; cursor: grab; user-select: none;
  transition: box-shadow .12s, opacity .12s, border-color .12s;
}
.tag:active { cursor: grabbing; }
.tag.dragging { opacity: .4; }
.tag.drop-target { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(var(--gold-rgb),.3); }
.tag-grip { color: #b8ae98; font-size: 13px; letter-spacing: -2px; cursor: grab; }
.tag button {
  border: none; background: #e6e0d3; color: #8a7a55; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; line-height: 1;
  display: grid; place-items: center;
}
.tag-x:hover { background: var(--danger); color: #fff; }
.tag-detail.on { background: var(--gold); color: #fff; }
.tag-detail:hover { filter: brightness(1.05); }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; padding: 10px 12px; }
.add-row .btn { padding: 10px 16px; }
.brand-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.brand-fields .brand-wide { grid-column: 1 / -1; }
.brand-fields .field > label { text-transform: none; letter-spacing: 0; }
@media (max-width: 620px) { .brand-fields { grid-template-columns: 1fr; } }

.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type=color] {
  width: 54px; height: 44px; padding: 4px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.color-hex { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.logo-uploader { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview {
  width: 180px; height: 72px; border: 1px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center; background:
    linear-gradient(45deg, #f2efe9 25%, transparent 25%, transparent 75%, #f2efe9 75%) 0 0/16px 16px,
    linear-gradient(45deg, #f2efe9 25%, #fff 25%, #fff 75%, #f2efe9 75%) 8px 8px/16px 16px;
  overflow: hidden; flex: none;
}
.logo-preview img { max-width: 164px; max-height: 60px; width: auto; }
.lp-empty { color: var(--muted); font-size: 12px; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.logo-actions .btn { width: auto; }

/* Logo trên thanh quản trị */
.topbar .logo img { max-height: 30px; max-width: 150px; vertical-align: middle; }

.notify-head { display: flex; align-items: center; justify-content: space-between; }
.notify-head h3 { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
.switch input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }
.set-badge { font-size: 11px; font-weight: 600; color: var(--accent); }
.notify-result { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.nr-line { font-size: 13px; padding: 8px 12px; border-radius: 9px; background: #f7f4ee; }
.nr-line.ok { background: #e9f7ef; color: #1c7a4a; }
.nr-line.error { background: #fdecec; color: var(--danger); }
.nr-line.off { color: var(--muted); }

.settings-bar { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.save-hint { color: var(--accent); font-size: 13px; font-weight: 600; }

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 940px) {
  .reg-shell { grid-template-columns: 1fr; }
  .brand-panel { align-items: stretch; }
  .brand-content { padding: 40px 26px; max-width: none; margin: 0; }
  .brand-top { margin-bottom: 30px; }
  .brand-desc { margin-bottom: 28px; }
  .brand-features { margin-bottom: 8px; }
  .brand-foot { display: none; }
  .form-panel { padding: 34px 22px 60px; }
  .settings-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 30px; }
}
@media (max-width: 480px) {
  .brand-title { font-size: 30px; }
  .brand-features li { font-size: 14px; }
  .form-head h2 { font-size: 25px; }
  .row { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .period-tabs { flex-wrap: wrap; }
  .form-panel { padding: 28px 16px 50px; }
}
