/* GoSolar Cambodia — stylesheet (T09: thi công thiết kế GHÉP B+A+C).
   - Xương sống B: wizard một cột, nền SÁNG, nút chạm ≥52px, cột giữa 560px trên desktop.
   - Bản sắc A: vàng hoàng gia + xanh đêm, hoạ tiết kbach kỷ hà, tiêu đề Khmer dùng Moul.
   - Màn kết quả C: thẻ số liệu số to, donut tự tiêu, cột bậc thang EDC — CSS/SVG thuần.
   Font: Noto Sans (Latin/Việt) + Noto Sans Khmer — chữ Khmer cần font riêng, fallback
   sans-serif thường vỡ dấu chồng (coeng). */
:root {
  /* Bản sắc Angkor (A) */
  --gold: #c9962c;
  --gold-light: #e8bc5c;
  --gold-soft: #fbf1dc;
  --night: #0f1b2e;
  --night-2: #1d3357;
  /* Nền sáng (B) */
  --text: #241a12;
  --muted: #6b6157;
  --bg: #fff;
  --bg-alt: #fffdf6;
  --line: #e7dcc6; /* đường kẻ trang trí — KHÔNG dùng làm viền điều khiển */
  --line-strong: #9c8f7a; /* viền ô nhập/nút: 3,17:1 trên nền trắng (WCAG 1.4.11) */
  --green: #1e7a4c;
  --green-soft: #e8f5ee;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(60, 34, 16, 0.1);
  --tap: 52px; /* chiều cao nút chạm tối thiểu (B) */
  --col: 560px; /* bề rộng cột giữa trên desktop (B) */
  /* Tên cũ giữ lại cho admin/portal đang dùng */
  --brand: var(--gold);
  --brand-dark: var(--night);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Noto Sans', 'Noto Sans Khmer', Arial, sans-serif;
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

:lang(km) {
  font-family: 'Noto Sans Khmer', 'Noto Sans', sans-serif;
  line-height: 1.85; /* chữ Khmer cao hơn Latin — tránh cắt dấu trên/dưới */
}

/* Tiêu đề hiển thị tiếng Khmer dùng Moul (A). Moul chỉ hợp chuỗi NGẮN — giới hạn ở h1/h2. */
:lang(km) h1,
:lang(km) h2.question,
:lang(km) .hero h1 {
  font-family: 'Moul', 'Noto Sans Khmer', serif;
  font-weight: 400;
  line-height: 1.75;
}

img {
  max-width: 100%;
}

/* `hidden` phải thắng mọi `display` của lớp bên dưới — nút Telegram, các bước wizard và
   #results đều dựa vào thuộc tính này để ẩn/hiện. */
[hidden] {
  display: none !important;
}

/* ── Hoạ tiết kbach (A): dải kỷ hà thuần CSS, dùng làm divider ───────── */
.kbach-rule {
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 26px);
}
.kbach-rule.thick {
  height: 9px;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.site-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.header-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  height: 40px; /* logo ngang GoSolar (SVG) — cao hơn logo V-Solar cũ một chút cho chữ đọc được */
  width: auto;
}

.lang-switcher {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lang-switcher button {
  font-family: inherit;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.lang-switcher button.active {
  background: var(--night);
  border-color: var(--night);
  color: #fff;
}

/* ── Khung cột giữa ──────────────────────────────────────────────────── */
main {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 0 40px;
  background: var(--bg);
  min-height: 70vh;
}

@media (min-width: 900px) {
  body {
    background:
      radial-gradient(circle at 8% 12%, rgba(201, 150, 44, 0.1) 0, transparent 42%),
      radial-gradient(circle at 92% 30%, rgba(29, 51, 87, 0.08) 0, transparent 40%),
      radial-gradient(circle at 12% 85%, rgba(30, 122, 76, 0.07) 0, transparent 40%), var(--bg-alt);
  }
  main {
    box-shadow: var(--shadow);
    border-radius: 0 0 28px 28px;
  }
}

section.screen {
  padding: 26px 20px 34px;
}

@media (max-width: 380px) {
  section.screen {
    padding: 22px 14px 30px;
  }
}

/* ── Hero (B khung + A bản sắc) ──────────────────────────────────────── */
.hero {
  text-align: center;
  background:
    radial-gradient(600px 220px at 50% -10%, rgba(201, 150, 44, 0.16), transparent 65%),
    linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(201, 150, 44, 0.05) 0 2px, transparent 2px 22px),
    repeating-linear-gradient(-45deg, rgba(201, 150, 44, 0.05) 0 2px, transparent 2px 22px);
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero .sun-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold));
  box-shadow: 0 12px 26px rgba(201, 150, 44, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}

.hero h1 {
  font-size: clamp(22px, 5.6vw, 30px);
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--night);
}

.hero p.sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 380px;
  margin: 0 auto 24px;
}

/* ── Thẻ chọn dòng sản phẩm ──────────────────────────────────────────── */
.landing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.landing-card {
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: 0.15s;
}

.landing-card.selected,
.landing-card:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.landing-card img {
  height: 38px;
  object-fit: contain;
  margin-bottom: 8px;
}

.landing-card h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.landing-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 3px 0 0;
}

/* ── Thanh tiến độ 4 bước + nhãn bước ────────────────────────────────── */
.progress {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.progress i {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.progress i.done,
.progress i.current {
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
}

.step-tag {
  display: inline-block;
  background: var(--gold-soft);
  color: #8a6416;
  font-weight: 800;
  font-size: 12px;
  padding: 5px 13px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.q-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  margin-bottom: 12px;
}

h2.question {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.45;
  margin: 0 0 6px;
}

h2.question.sub-question {
  font-size: 17px;
  margin-top: 26px;
}

p.hint {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* ── Segmented control: nút chạm to phản chiếu <select> ẩn (wizard.js) ─ */
.seg {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.seg.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.seg.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.seg button {
  font-family: inherit;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.seg button.active {
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* Vùng khí hậu: hàng dọc, dấu tích — đường CHÍNH khi bản đồ hỏng (T12/Q11). */
.seg.regions {
  grid-template-columns: 1fr;
}

.seg.regions button {
  justify-content: space-between;
  border-radius: 999px;
  padding: 0 18px;
}

.seg.regions button::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex-shrink: 0;
}

.seg.regions button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: #0e6b3a;
}

.seg.regions button.active::after {
  background: var(--green)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5'/%3E%3C/svg%3E")
    center/13px no-repeat;
  border-color: var(--green);
}

/* Select ẩn nhưng vẫn trong DOM: app.js đọc `.value`, wizard.js đồng bộ hai chiều. */
.seg-source {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Trường nhập ─────────────────────────────────────────────────────── */
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.field-stack label,
.calc-grid label,
.inline-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
textarea {
  font-family: inherit;
}

.field-stack input,
.field-stack select,
.calc-grid input,
.calc-grid select,
.inline-row input,
.inline-row select,
.search-box input {
  min-height: var(--tap);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
}

.field-stack input:focus,
.field-stack select:focus,
.calc-grid input:focus,
.calc-grid select:focus {
  border-color: var(--gold);
}

.field-stack select:disabled {
  background: var(--bg-alt);
  color: #a79c8c;
}

:focus-visible {
  outline: 3px solid var(--night);
  outline-offset: 2px;
}

/* Trên dải nền tối, vòng xanh đêm biến mất — đổi sang vàng sáng. */
body[data-layout='panorama'] .hero :focus-visible,
body[data-layout='panorama'] .trust-strip :focus-visible,
body[data-layout='panorama'] .wizard-step[data-step='4'] :focus-visible,
body[data-layout='panorama'] .site-header :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--gold-light);
}

/* Ô nhập tiền điện: con số TO là ngôi sao của bước 2 (B). */
.amount-block {
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  background: var(--bg);
}

.amount-block .amount-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.amount-block .amount-row input {
  border: 0;
  min-height: auto;
  padding: 0;
  font-size: 32px;
  font-weight: 800;
  width: 100%;
  background: transparent;
}

.amount-block .amount-row input::-webkit-outer-spin-button,
.amount-block .amount-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-block .amount-row .curr {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
}

.amount-block .seg {
  margin: 12px 0 0;
}

.amount-block .seg button {
  min-height: 46px;
  border-radius: 999px;
  font-size: 13px;
}

/* ── Nút ─────────────────────────────────────────────────────────────── */
.btn-primary,
.btn-giant {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  border-radius: 999px;
}

.btn-giant {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  font-size: 16.5px;
  color: #2b1d00;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  box-shadow: 0 8px 20px rgba(201, 150, 44, 0.32);
}

.btn-primary {
  background: var(--night);
  color: #fff;
  padding: 12px 22px;
  min-height: 46px;
  font-size: 15px;
}

.btn-ghost {
  font-family: inherit;
  background: none;
  border: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 4px;
  cursor: pointer;
}

.step-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.step-nav .btn-giant {
  flex: 1;
}

/* ── Bản đồ (T12) ────────────────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
  border-radius: 999px;
}

#map-canvas {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  margin-bottom: 10px;
}

#opp-map {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.map-suggestions {
  position: relative;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  margin: -8px 0 12px;
  overflow: hidden;
}

.map-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.map-suggestions button:hover {
  background: var(--gold-soft);
}

/* ── Màn kết quả kiểu dashboard (C) ──────────────────────────────────── */
.result-card {
  background: linear-gradient(160deg, var(--bg-alt) 0%, var(--bg) 55%);
  border: 2px solid var(--gold-soft);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(201, 150, 44, 0.22), transparent 70%);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
}

.kwp-badge {
  background: var(--night);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
}

.share-btn {
  font-family: inherit;
  border: 2px solid var(--line-strong);
  background: var(--bg);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.price-hero {
  text-align: center;
  margin-bottom: 16px;
  position: relative;
}

.price-hero .price-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.price-hero .price-main {
  font-size: 36px;
  font-weight: 800;
  color: var(--night);
  line-height: 1.2;
}

.price-hero .price-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
}

.stat-tile {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-tile .val {
  font-size: 19px;
  font-weight: 800;
  color: var(--green);
  line-height: 1.25;
}

.stat-tile .val.gold {
  color: #a8791d;
}

.stat-tile .val.ink {
  color: var(--night);
}

.stat-tile .lbl {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Donut tỷ lệ tự tiêu — SVG thuần, không thư viện */
.donut-box {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  background: var(--bg);
  margin-bottom: 14px;
  position: relative;
}

.donut-wrap {
  position: relative;
  width: 122px;
  height: 122px;
  margin: 6px auto 8px;
}

.donut-wrap svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center .p {
  font-size: 25px;
  font-weight: 800;
  color: var(--green);
}

.donut-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.donut-legend .sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 5px;
}

/* Cột bậc thang EDC trước/sau */
.chart-box {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--bg);
  margin-bottom: 14px;
  position: relative;
}

.chart-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.edc-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 120px;
}

.edc-pair {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  flex: 1;
  height: 100%;
}

.edc-col {
  flex: 1;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 2px;
}

.edc-col.before {
  background: linear-gradient(180deg, var(--night-2), var(--night));
}

.edc-col.after {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
}

.edc-col span {
  position: relative;
  top: -17px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
}

.edc-labels {
  display: flex;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
}

.edc-labels span {
  flex: 1;
  text-align: center;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.chart-legend .sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 5px;
}

/* Biểu đồ so sánh vẽ bằng SVG (charts.js) — màu qua class để dải nền tối tự đổi. */
.gs-chart {
  width: 100%;
  height: 132px;
  display: block;
}

.gs-area {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.gs-area.gs-solar {
  fill: rgba(201, 150, 44, 0.35);
  stroke: var(--gold);
}

.gs-area.gs-load {
  fill: rgba(29, 51, 87, 0.22);
  stroke: var(--night-2);
}

.gs-bar.gs-solar {
  fill: var(--gold);
}

.gs-bar.gs-load {
  fill: var(--night-2);
}

.gs-axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.gs-tick {
  fill: var(--muted);
  font-size: 10px;
  font-family: inherit;
}

.chart-legend .sw-solar {
  background: var(--gold);
}

.chart-legend .sw-load {
  background: var(--night-2);
}

.chart-note {
  margin: 8px 0 0;
  font-size: 12px;
}

/* Huy hiệu & lời khuyên */
.advice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--gold-soft);
  border: 1.5px solid #eddcb4;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 0 0 12px;
  position: relative;
}

.advice.ok {
  background: var(--green-soft);
  border-color: #bfe9d2;
  color: #0e6b3a;
}

.advice:empty {
  display: none;
}

details.result-detail {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--bg);
  position: relative;
}

details.result-detail summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
}

/* ── Bảng (kết quả chi tiết, portal, admin) ─────────────────────────── */
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}

.result-table th,
.result-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.result-table th {
  width: 48%;
  font-weight: 700;
  color: var(--muted);
}

.result-table.tiers th {
  width: auto;
}

/* ── Lưới form dùng chung (portal/admin giữ nguyên tên lớp) ─────────── */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.inline-row {
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
}

.scenario-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.scenario-tabs button {
  font-family: inherit;
  border: 2px solid var(--line-strong);
  background: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

.scenario-tabs button.active {
  background: var(--night);
  border-color: var(--night);
  color: #fff;
}

.card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 12px 0;
  background: var(--bg);
}

.muted {
  color: var(--muted);
  font-size: 13.5px;
}

.msg {
  color: #92400e;
  font-weight: 700;
  background: var(--gold-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 12px 0;
}

.msg.error {
  color: #b91c1c;
  background: #fef2f2;
}

.warn {
  color: #b91c1c;
  font-size: 12px;
}

.doc-links a {
  margin-right: 12px;
  font-size: 13.5px;
}

/* ── Cấu hình gói khoe cho khách (T15) ───────────────────────────────── */
/* Danh sách định nghĩa hai cột trên desktop, một cột trên máy hẹp. Nhãn tiếng Khmer dài hơn
   tiếng Việt/Anh khá nhiều nên KHÔNG đặt bề rộng cột cứng — để `max-content` tự co. */
.pkg-config {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--gold-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.pkg-config h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--night);
}

.config-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 14px;
}

.config-list dt {
  color: var(--muted);
}

.config-list dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 420px) {
  .config-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .config-list dd {
    margin-bottom: 8px;
  }
}

/* ── Form nhận báo giá ───────────────────────────────────────────────── */
#contact-section {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

#contact-section h2 {
  font-size: 20px;
  margin: 0 0 6px;
}

/* ── Footer (nền xanh đêm — bản sắc A) ───────────────────────────────── */
.site-footer {
  background: var(--night);
  color: #d8d3c9;
  padding: 0 0 24px;
}

.footer-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 26px 20px 0;
  text-align: center;
}

.site-footer .footer-logo {
  height: 30px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  margin-bottom: 14px;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  margin: 0 0 14px;
}

.footer-contact a,
.footer-contact span {
  color: #e6e1d6;
  text-decoration: none;
}

.tg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  background: #27a7e7;
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  margin-bottom: 16px;
  cursor: pointer;
}

/* Lối vào của nhân sự: có mặt nhưng không tranh chỗ với nội dung bán hàng. */
.staff-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: #9a958c;
  text-decoration: underline;
}

.staff-nav {
  display: flex;
  gap: 14px;
  font-size: 13.5px;
  font-weight: 700;
}

.staff-nav a {
  color: var(--night);
  text-decoration: none;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 2px;
}

.footer-legal {
  font-size: 11.5px;
  color: #8b8880;
  border-top: 1px solid #2a3547;
  padding-top: 14px;
  margin: 0;
}

/* ── Portal (T07) ────────────────────────────────────────────────────── */
tr.overdue td {
  background: #fef2f2;
}

.survey-item {
  display: block;
  padding: 4px 0;
}

/* Portal/admin là bàn làm việc — cần bề ngang, không bó theo cột wizard. */
body.workbench main,
body.workbench .header-inner,
body.workbench .footer-inner {
  max-width: 1080px;
}

body.workbench main {
  padding: 24px 16px;
  box-shadow: none;
  border-radius: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   T17 — hai cách trình bày trên CÙNG một DOM
   `wizard`   : mỗi lần một bước, nền sáng (mặc định mobile — nguyên trạng T09).
   `panorama` : mở hết, bố cục dải theo bản A gốc, có dải nền tối (mặc định ≥1000px).
   `js/wizard.js` đặt `body[data-layout]`; CSS ở đây là toàn bộ phần khác nhau.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Thanh tiến độ kiêm chỉ mục + nút chuyển chế độ ──────────────────── */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.progress {
  flex: 1;
}

.progress button {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.progress button i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}

.progress button.done i,
.progress button.current i {
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
}

.progress button.current {
  color: var(--text);
  font-weight: 800;
}

.progress button span {
  display: none; /* mobile chỉ cần 4 vạch; nhãn chặng chỉ hiện ở chế độ toàn trang */
}

.layout-toggle {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.trust-strip {
  display: none; /* chỉ thuộc bố cục toàn trang */
}

/* ── Chế độ toàn trang ───────────────────────────────────────────────── */
body[data-layout='panorama'] {
  background: var(--bg-alt);
}

/* Mở lại các bước bị `hidden` — chọn lọc hơn `[hidden]` nên thắng đúng chỗ, không đụng
   `#results` (vẫn ẩn cho tới khi tính xong). */
body[data-layout='panorama'] .wizard-step[hidden] {
  display: block !important;
}

body[data-layout='panorama'] main {
  max-width: none;
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

/* Dải nền tràn ngang, nội dung vẫn bó trong 1180px (bản A gốc). */
body[data-layout='panorama'] section.screen {
  padding: 52px max(20px, calc(50% - 590px));
}

body[data-layout='panorama'] .site-header {
  background: var(--night);
  border-bottom-color: transparent;
}

body[data-layout='panorama'] .header-inner {
  max-width: 1180px;
}

body[data-layout='panorama'] .lang-switcher button {
  background: transparent;
  border-color: rgba(201, 150, 44, 0.6); /* 3,1:1 trên nền xanh đêm (WCAG 1.4.11) */
  color: var(--gold-light);
}

body[data-layout='panorama'] .lang-switcher button.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--night);
}

/* Hero tối */
body[data-layout='panorama'] .hero {
  background:
    radial-gradient(1100px 500px at 50% -10%, rgba(201, 150, 44, 0.25), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 55%, #3c2210 100%);
  color: #faf4ea;
  padding-top: 56px;
  padding-bottom: 60px;
}

body[data-layout='panorama'] .hero h1 {
  color: var(--gold-light);
  font-size: clamp(30px, 3.4vw, 44px);
  text-shadow: 0 2px 18px rgba(201, 150, 44, 0.25);
}

body[data-layout='panorama'] .hero p.sub {
  color: #e6cda3;
  font-size: 16px;
  max-width: 560px;
}

body[data-layout='panorama'] .landing-cards {
  max-width: 900px;
  margin: 0 auto 22px;
  gap: 22px;
}

/* Thẻ sản phẩm giữ NỀN GIẤY như bản A gốc, dù nổi trên hero tối: logo Solarhome/Solargarden
   là chữ sẫm màu, đặt lên nền tối là mất nét. */
body[data-layout='panorama'] .landing-card {
  background: var(--paper, #fffaf1);
  border-color: rgba(201, 150, 44, 0.45);
  text-align: left;
  padding: 26px 24px;
}

body[data-layout='panorama'] .landing-card img {
  height: 46px;
}

body[data-layout='panorama'] .landing-card h2 {
  color: var(--night);
  font-size: 20px;
}

body[data-layout='panorama'] .landing-card p {
  color: #6b5236;
  font-size: 14.5px;
}

/* Logo hiện tại là chữ sẫm — trên header tối phải có nền sáng mới đọc được (ràng buộc "giữ
   logo hiện tại" của T09, nên không đổi logo, chỉ lót nền). */
body[data-layout='panorama'] .brand {
  background: #fff;
  border-radius: 10px;
  padding: 4px 10px;
}

body[data-layout='panorama'] .hero .btn-giant {
  max-width: 320px;
  margin: 0 auto;
}

/* Dải cam kết (nền nâu tối — bản A gốc) */
body[data-layout='panorama'] .trust-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  background: #3c2210;
  color: #f3e6d0;
  padding: 34px max(20px, calc(50% - 590px));
}

.trust-item {
  border: 1px solid rgba(201, 150, 44, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 18px 16px;
  text-align: center;
}

.trust-item .ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
  font-weight: 700;
}

.trust-item p {
  margin: 0;
  font-size: 14px;
  color: #e6cda3;
}

/* Khối máy tính: lưới hai cột — trái bản đồ + vùng, phải chuỗi nhập */
body[data-layout='panorama'] #calculator-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

body[data-layout='panorama'] .progress-bar {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 58px;
  z-index: 15;
  background: rgba(255, 253, 246, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  margin: 0;
}

body[data-layout='panorama'] .progress button span {
  display: block;
}

body[data-layout='panorama'] .wizard-step[data-step='1'] {
  grid-column: 1;
  grid-row: 2 / 4;
}

body[data-layout='panorama'] .wizard-step[data-step='2'] {
  grid-column: 2;
  grid-row: 2;
}

body[data-layout='panorama'] .wizard-step[data-step='3'] {
  grid-column: 2;
  grid-row: 3;
}

body[data-layout='panorama'] .wizard-step[data-step='4'] {
  grid-column: 1 / -1;
  grid-row: 4;
}

/* Bước 1–3 thành panel giấy có khung kbach (bản A gốc) */
body[data-layout='panorama'] .wizard-step[data-step='1'],
body[data-layout='panorama'] .wizard-step[data-step='2'],
body[data-layout='panorama'] .wizard-step[data-step='3'] {
  background: var(--bg);
  border: 1px solid var(--line);
  outline: 1px solid rgba(201, 150, 44, 0.35);
  outline-offset: 4px;
  border-radius: 16px;
  padding: 26px 24px;
}

body[data-layout='panorama'] #map-canvas {
  height: 260px;
}

/* Nút chuyển bước là chuyện của wizard; toàn trang chỉ giữ nút TÍNH. */
body[data-layout='panorama'] [data-wizard-next],
body[data-layout='panorama'] [data-wizard-back] {
  display: none;
}

/* Dải kết quả nền xanh đêm */
body[data-layout='panorama'] .wizard-step[data-step='4'] {
  background: linear-gradient(180deg, var(--night), var(--night-2));
  color: #faf4ea;
  border-radius: 24px;
  padding: 32px 28px;
}

body[data-layout='panorama'] .wizard-step[data-step='4'] .step-tag {
  background: rgba(201, 150, 44, 0.18);
  color: var(--gold-light);
}

body[data-layout='panorama'] .wizard-step[data-step='4'] h2.question {
  color: var(--gold-light);
}

body[data-layout='panorama'] .result-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(201, 150, 44, 0.3);
  box-shadow: none;
}

body[data-layout='panorama'] .price-hero .price-main {
  color: var(--gold-light);
  font-size: clamp(38px, 4vw, 54px);
}

body[data-layout='panorama'] .price-hero .price-label,
body[data-layout='panorama'] .price-hero .price-sub,
body[data-layout='panorama'] .stat-tile .lbl,
body[data-layout='panorama'] .donut-legend,
body[data-layout='panorama'] .chart-legend,
body[data-layout='panorama'] .edc-labels,
body[data-layout='panorama'] .edc-col span,
body[data-layout='panorama'] #result-nofeed,
body[data-layout='panorama'] details.result-detail summary {
  color: #cbb894;
}

body[data-layout='panorama'] .stat-grid {
  grid-template-columns: repeat(4, 1fr);
}

body[data-layout='panorama'] .stat-tile,
body[data-layout='panorama'] .donut-box,
body[data-layout='panorama'] .chart-box,
body[data-layout='panorama'] details.result-detail {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(201, 150, 44, 0.3);
}

body[data-layout='panorama'] .stat-tile .val {
  color: #7fe3ae;
}

body[data-layout='panorama'] .stat-tile .val.gold {
  color: var(--gold-light);
}

body[data-layout='panorama'] .stat-tile .val.ink,
body[data-layout='panorama'] .chart-title,
body[data-layout='panorama'] .result-table th,
body[data-layout='panorama'] .result-table td {
  color: #faf4ea;
}

body[data-layout='panorama'] .result-table th,
body[data-layout='panorama'] .result-table td {
  border-bottom-color: rgba(201, 150, 44, 0.2);
}

body[data-layout='panorama'] .donut-center .p {
  color: #7fe3ae;
}

/* Donut + biểu đồ bậc thang đứng CẠNH NHAU (thẻ kết quả thành flex, các khối khác vẫn
   chiếm trọn hàng). */
body[data-layout='panorama'] .result-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

body[data-layout='panorama'] .result-card > * {
  width: 100%;
  margin: 0;
}

body[data-layout='panorama'] .donut-box,
body[data-layout='panorama'] .chart-box {
  width: calc(50% - 7px);
}

body[data-layout='panorama'] #day-chart-wrap {
  width: 100%;
}

body[data-layout='panorama'] .advice {
  background: rgba(201, 150, 44, 0.12);
  border-color: rgba(201, 150, 44, 0.35);
  color: #f3e6d0;
}

body[data-layout='panorama'] .advice.ok {
  background: rgba(30, 122, 76, 0.18);
  border-color: rgba(127, 227, 174, 0.35);
  color: #b9f0d2;
}

body[data-layout='panorama'] .gs-area.gs-load {
  fill: rgba(255, 255, 255, 0.18);
  stroke: #cbb894;
}

body[data-layout='panorama'] .gs-bar.gs-load {
  fill: #6b7d9e;
}

body[data-layout='panorama'] .chart-legend .sw-load {
  background: #6b7d9e;
}

body[data-layout='panorama'] .gs-tick {
  fill: #cbb894;
}

body[data-layout='panorama'] .gs-axis {
  stroke: rgba(201, 150, 44, 0.4);
}

body[data-layout='panorama'] .chart-note {
  color: #cbb894;
}

body[data-layout='panorama'] .kwp-badge {
  background: var(--gold);
  color: var(--night);
}

body[data-layout='panorama'] .share-btn {
  background: transparent;
  border-color: rgba(201, 150, 44, 0.6); /* 3,1:1 trên nền xanh đêm (WCAG 1.4.11) */
  color: var(--gold-light);
}

/* Form lead + chân trang bó theo cùng bề ngang */
body[data-layout='panorama'] #contact-section {
  background: var(--bg-alt);
}

body[data-layout='panorama'] #contact-section .field-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

body[data-layout='panorama'] #contact-section .btn-giant {
  max-width: 360px;
}

body[data-layout='panorama'] .footer-inner {
  max-width: 1180px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

body[data-layout='panorama'] .footer-contact {
  margin: 0;
}

body[data-layout='panorama'] .tg-btn {
  width: auto;
  padding: 0 26px;
  margin: 0;
}

body[data-layout='panorama'] .footer-legal,
body[data-layout='panorama'] .staff-link {
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════════════════════════════
   Admin (bố cục lại 2026-09-04): sidebar + nội dung, màn Tổng quan chỉ đường,
   khối "Cách dùng" gập/mở ở mỗi mục. Token màu dùng lại của trang khách; chỉ thêm
   lớp bố cục. ≥900px: sidebar trái dính; dưới đó: sidebar thành dải cuộn ngang.
   ═══════════════════════════════════════════════════════════════════════ */
body.admin main {
  max-width: 1240px;
  padding: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ic {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Màn đăng nhập / không đủ quyền: cột hẹp giữa trang */
.auth-panel {
  max-width: 480px;
  margin: 24px auto;
  padding: 24px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
}

.auth-panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

/* ── Khung sidebar + nội dung ────────────────────────────────────────── */
.admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .admin-shell {
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 24px;
  }
  .admin-side {
    position: sticky;
    top: 72px;
  }
}

.admin-side {
  /* min-width: 0 — dải nav cuộn ngang trên mobile không được nống ô grid rộng hơn màn hình. */
  min-width: 0;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
}

.admin-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  flex-shrink: 0;
}

.admin-account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.admin-email {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7a5410;
  width: fit-content;
}

.role-badge.is-admin {
  background: var(--night);
  color: #fff;
}

.btn-icon {
  font-family: inherit;
  width: 44px;
  height: 44px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* Điều hướng mục: icon + tên + mô tả một dòng */
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  border-left: 4px solid transparent;
  transition: background 0.2s;
}

.admin-nav a:hover {
  background: var(--bg-alt);
}

.admin-nav a.active {
  background: var(--gold-soft);
  border-left-color: var(--gold);
}

.admin-nav .ic {
  color: var(--muted);
}

.admin-nav a.active .ic {
  color: #7a5410;
}

.nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.nav-text b {
  font-size: 14px;
}

.nav-text small {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 899px) {
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .admin-nav a {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }
  .admin-nav a.active {
    border-bottom-color: var(--gold);
  }
  .nav-text small {
    display: none;
  }
}

/* ── Nội dung mục ────────────────────────────────────────────────────── */
.admin-content {
  min-width: 0;
}

.admin-section > .card {
  margin: 12px 0;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.3;
}

.section-head .muted {
  margin: 0;
  max-width: 70ch;
}

.admin-section h2 {
  font-size: 17px;
  margin: 0 0 8px;
}

/* Cách dùng: gập mặc định, mở ra là danh sách bước ngắn */
.howto {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin: 0 0 14px;
}

.howto summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--night);
  list-style: none;
}

.howto summary::-webkit-details-marker {
  display: none;
}

.howto summary::after {
  content: '+';
  margin-left: auto;
  font-size: 18px;
  color: var(--muted);
}

.howto[open] summary::after {
  content: '−';
}

.howto ol {
  margin: 0;
  padding: 0 16px 12px 36px;
  font-size: 14px;
}

.howto li {
  margin: 4px 0;
}

/* Thanh công cụ trên bảng */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.toolbar .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolbar-note {
  margin-left: auto;
}

.btn-secondary {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  min-height: 46px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-alt);
}

.btn-danger {
  font-family: inherit;
  border: 2px solid #f1c3c3;
  background: #fff5f5;
  color: #b91c1c;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  min-height: 46px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 13px;
}

.form-card {
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.form-actions .spacer {
  flex: 1;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-height: 44px;
}

.check-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
}

/* Bảng dữ liệu: tiêu đề cột thật, cuộn ngang trong khung, không tràn trang */
.table-scroll {
  overflow-x: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.data-table {
  margin: 0;
}

.data-table th {
  width: auto;
  white-space: nowrap;
  background: var(--bg-alt);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 10px 12px;
}

.data-table td {
  padding: 10px 12px;
}

.data-table tbody tr:hover td {
  background: #fffaf0;
}

.data-table .row-actions {
  white-space: nowrap;
  text-align: right;
}

.data-table input,
.data-table select {
  min-height: 40px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 14px;
  width: 100%;
  min-width: 96px;
  margin: 2px 0;
}

.empty-state {
  margin: 10px 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.kind-tabs {
  margin-bottom: 12px;
}

/* ── Tổng quan: năm bước theo thứ tự dựng ─────────────────────────────── */
.step-flow {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.step-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.step-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--night);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.step-body b {
  font-size: 15px;
}

.step-stat {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.step-stat.ok {
  color: var(--green);
}

.step-stat.todo {
  color: #92400e;
}

.step-stat:empty {
  display: none;
}

.guide-card h2 {
  margin-top: 0;
}

.guide-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
}

.guide-list li {
  margin: 6px 0;
}

/* Lời nhắc có icon */
.admin .advice .ic {
  color: #92400e;
}

.admin .advice button {
  margin-left: auto;
}

/* Thông báo kết quả nổi phía trên nội dung */
.admin .msg {
  position: sticky;
  top: 64px;
  z-index: 10;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  .admin-nav a,
  .step-card,
  .btn-secondary,
  .btn-danger,
  .btn-icon {
    transition: none;
  }
}

/* ── Portal Sale (bố cục lại 2026-09-04, dùng chung khung .admin-*) ─────── */
.filter-chips {
  gap: 6px;
  margin-bottom: 12px;
}

.filter-chips button {
  padding: 7px 14px;
  font-size: 13px;
  min-height: 40px;
}

/* Huy hiệu chặng / trạng thái báo giá: màu + chữ, không chỉ màu (1.4.1) */
.stage-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
  color: var(--text);
  white-space: nowrap;
  margin-bottom: 4px;
}

.stage-badge.stage-screening,
.stage-badge.quote-draft {
  background: #eef2f7;
  border-color: #b9c4d3;
  color: #2b3a52;
}

.stage-badge.stage-surveying {
  background: var(--gold-soft);
  border-color: #d9b96a;
  color: #7a5410;
}

.stage-badge.stage-quoting,
.stage-badge.stage-negotiating,
.stage-badge.quote-sent {
  background: #e6efff;
  border-color: #9db6e6;
  color: #1d3a7a;
}

.stage-badge.stage-won,
.stage-badge.quote-accepted,
.stage-badge.is-done {
  background: var(--green-soft);
  border-color: #8fd1ac;
  color: #0e6b3a;
}

.stage-badge.stage-lost,
.stage-badge.quote-rejected {
  background: #fef2f2;
  border-color: #f1a9a9;
  color: #b91c1c;
}

.stage-badge.stage-paused {
  background: #f3f4f6;
  border-color: #c3c7cf;
  color: #4b5563;
}

.step-stat.warn-soft {
  color: #7a5410;
}

.data-table tr.is-open td {
  background: var(--gold-soft);
}

.data-table tr.overdue td:first-child {
  box-shadow: inset 4px 0 0 #b91c1c;
}

/* Chi tiết một cơ hội */
.opp-detail {
  margin-top: 18px;
  scroll-margin-top: 80px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-head .btn-secondary {
  display: inline-flex;
  gap: 4px;
}

.detail-title {
  flex: 1;
  min-width: 200px;
}

.detail-title h2 {
  margin: 4px 0 2px;
  font-size: 20px;
}

.detail-title .muted {
  margin: 0;
}

.detail-head .stage-badge {
  font-size: 13px;
  padding: 6px 14px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

.sub-card {
  margin: 12px 0 0;
  border-color: var(--line);
  box-shadow: none;
}

.sub-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.sub-card > .muted {
  margin: 0 0 8px;
}

.sub-card .calc-grid {
  margin: 10px 0;
}

.survey-list {
  display: grid;
  gap: 4px;
  margin: 6px 0;
}

.survey-list .survey-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 14px;
}

.survey-list .survey-item:hover {
  background: var(--bg-alt);
}

.survey-list input[type='checkbox'] {
  width: 20px;
  height: 20px;
}

#quote-copy-text {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.admin-nav a.nav-external {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 14px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

@media (max-width: 899px) {
  .admin-nav a.nav-external {
    border-top: 0;
    margin-top: 0;
    padding-top: 10px;
  }
}
