/* Hinosoft UI: bộ token + thành phần dùng chung cho mọi web app (B2C và B2B).
   base.html nạp file này SAU site.css và CSS riêng của từng app, nên phần "cầu nối" cuối file
   đồng bộ được nút / ô nhập / thẻ của các app cũ mà không phải sửa mã JS sinh ra chúng.

   Mỗi app chỉ đổi màu nhấn qua class trên <body> (block body_class): app-quynhom, app-giapha, app-thiep,
   app-caopho, app-doixe, app-inanh, app-giavang. Bố cục, cỡ chữ, khoảng cách, hành vi giống nhau. */

:root {
  /* Màu nền tảng */
  --ink: #16202d;
  --muted: #4f5b6a;            /* đậm hơn #5b6878 cũ: tương phản 7:1 trên nền trắng, 6.4:1 trên nền nhạt */
  --line: #dfe5ec;
  --line-strong: #c6cfda;
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --surface: #ffffff;

  /* Màu nhấn (mặc định = màu thương hiệu xanh). App đổi bằng body.app-… */
  --accent: #1554c0;
  --accent-strong: #0d3a8a;
  --accent-ink: #ffffff;
  --accent-soft: #eef3fb;

  /* Trạng thái */
  --danger: #b42318;   --danger-soft: #fef3f2;   --danger-line: #fecdca;
  --success: #067647;  --success-soft: #ecfdf3;  --success-line: #abefc6;
  --warning: #93370d;  --warning-soft: #fffaeb;  --warning-line: #fedf89;

  /* Khoảng cách (thang 4px) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px;
  --section-y: clamp(40px, 6vw, 72px);

  /* Bo góc, đổ bóng */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 38, 77, .06), 0 1px 3px rgba(16, 38, 77, .08);
  --shadow: 0 6px 24px rgba(16, 38, 77, .08);
  --shadow-lg: 0 18px 48px rgba(16, 38, 77, .14);

  /* Kiểu chữ */
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: .8125rem;
  --fs-sm: .9rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-h1: clamp(1.85rem, 4.2vw, 2.75rem);
  --fs-h2: clamp(1.35rem, 2.6vw, 1.75rem);
  --fs-h3: 1.15rem;

  /* Điều khiển: tối thiểu 44px để bấm bằng ngón tay */
  --tap: 44px;
  --control-h: 48px;
  --control-fs: max(16px, 1rem); /* < 16px thì Safari iOS tự phóng to trang khi chạm vào ô nhập */
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* Màu nhấn từng app */
.app-quynhom { --accent: #0e7c66; --accent-strong: #0a5c4c; --accent-soft: #e7f4f0; }
.app-giapha  { --accent: #9e2b25; --accent-strong: #7a1f1a; --accent-soft: #f7f1ec; }
.app-thiep   { --accent: #a3192b; --accent-strong: #7f1221; --accent-soft: #fbf1ee; }
.app-caopho  { --accent: #2b2b2b; --accent-strong: #111111; --accent-soft: #f1f1ef; }
.app-doixe   { --accent: #1f4e79; --accent-strong: #163a5b; --accent-soft: #eef3f8; }
.app-inanh   { --accent: #1554c0; --accent-strong: #0d3a8a; --accent-soft: #eef3fb; }
.app-giavang { --accent: #8a6116; --accent-strong: #5e4614; --accent-soft: #faf6ee; }
.app-solienlac { --accent: #4a3aa8; --accent-strong: #352a7e; --accent-soft: #f1effa; }

/* Trên nền tối (hero trang chủ, landing quảng cáo, khối CTA) nút chính giữ màu cam thương hiệu, chữ tối cho đủ tương phản. */
.hero, .lp-hero, .block-cta { --accent: #ff8a1f; --accent-strong: #f07400; --accent-ink: #16202d; }
.theme-gold .lp-hero { --accent: #c49a3c; --accent-strong: #a9802a; --accent-ink: #1c160e; }

/* ---------- Kiểu chữ chung ---------- */
h1 { font-size: var(--fs-h1); letter-spacing: -.01em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
.muted { color: var(--muted); }
.lead { font-size: var(--fs-lg); color: var(--muted); }
.eyebrow {
  margin: 0 0 var(--space-2); color: var(--accent-strong); font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Hero chung cho trang app + trang nội dung ---------- */
.app-hero, .page-hero {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
  padding: clamp(32px, 6vw, 72px) 0 clamp(32px, 5vw, 56px);
  border-bottom: 0;
}
.app-hero h1, .page-hero h1 { margin-bottom: var(--space-3); }
.page-hero .lead { margin-bottom: 0; }
.app-hero-grid {
  display: grid; gap: clamp(24px, 4vw, 48px); align-items: start;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
}
.app-hero-grid--media { align-items: center; }
@media (max-width: 860px) { .app-hero-grid { grid-template-columns: minmax(0, 1fr); } }
.app-hero .lead { max-width: 62ch; }
.app-hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; }
.app-hero-media { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.app-hero + .section { padding-top: var(--section-y); }

/* Danh sách điểm nổi bật */
.points { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-3); }
.points li { position: relative; padding-left: 28px; }
.points li::before {
  content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-soft); box-shadow: inset 0 0 0 4px var(--accent);
}
.points code { font-size: .9em; background: var(--bg-alt); padding: .05em .35em; border-radius: 4px; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: var(--control-h); padding: .6em 1.35em; border-radius: var(--radius-pill);
  border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: var(--fs-md); font-weight: 600; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { text-decoration: none; background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); transform: none; box-shadow: none; }
.btn:active { transform: translateY(1px); }
.btn-lg { min-height: 52px; padding: .75em 1.7em; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: .35em .9em; font-size: var(--fs-sm); }
.btn-block { display: flex; width: 100%; }
.btn-secondary { background: var(--surface); color: var(--accent-strong); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-strong); }
.btn-light { background: #fff; color: var(--brand-dark, #0d3a8a); border-color: #fff; }
.btn-light:hover { background: #eef3fb; border-color: #eef3fb; color: var(--brand-dark, #0d3a8a); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
/* Đang gửi (site.js gắn aria-busy cho nút submit của form có data-busy) */
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.btn[aria-busy="true"]::before {
  content: ""; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: ui-spin .7s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"]::before { animation-duration: 2s; } }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* ---------- Thẻ + form ---------- */
.card-surface {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow);
}
.form-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow); min-width: 0;
}
.form-card > h2 { font-size: 1.3rem; margin: 0 0 var(--space-4); }
.form-card .btn[type="submit"] { width: 100%; margin-top: var(--space-2); }
.form-note { font-size: var(--fs-sm); color: var(--muted); margin: var(--space-3) 0 0; }

.form .field, .form-card .field { margin-bottom: var(--space-4); }
.form label, .form-card .field > label {
  display: block; font-weight: 600; font-size: .95rem; color: var(--ink); margin-bottom: 6px;
}
.form-card .field-opt { font-weight: 400; color: var(--muted); }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
.form select, .form textarea, .input {
  width: 100%; min-height: var(--control-h); padding: .6em .85em; font: inherit; font-size: var(--control-fs);
  color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  transition: border-color .15s, box-shadow .15s;
}
.form textarea, textarea.input { min-height: 120px; line-height: 1.5; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
.form input::placeholder, .form textarea::placeholder, .input::placeholder { color: #7b8794; }
.form input[aria-invalid="true"], .has-error input, .has-error textarea { border-color: var(--danger); }
.field-help { font-size: var(--fs-sm); color: var(--muted); margin: 6px 0 0; }
.field-error { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; margin: 6px 0 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 var(--space-4); }
@media (max-width: 480px) { .field-row { grid-template-columns: minmax(0, 1fr); } }

/* Lựa chọn dạng thẻ (radio) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-4); }
.choice-grid label {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); margin: 0;
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  font-weight: 600; font-size: .95rem; cursor: pointer; background: #fff;
}
.choice-grid input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }
.choice-grid label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-grid label:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* Thông báo */
.notice {
  border: 1px solid var(--line); background: var(--bg-alt); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); font-size: .95rem;
}
.notice--error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); font-weight: 600; }
.notice--success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.notice--warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.notice > :last-child { margin-bottom: 0; }

/* ---------- Bảng số liệu ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table thead th { background: var(--bg-alt); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3em; padding: .15em .65em; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; background: var(--accent-soft); color: var(--accent-strong);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--muted { background: var(--bg-alt); color: var(--muted); }

/* ---------- Khối "các bước", "tính năng" ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: var(--space-4); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.tile > b, .tile > strong:first-child { display: block; color: var(--accent-strong); font-size: 1.05rem; margin-bottom: 4px; }
.num-steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-3); }
.num-steps li { counter-increment: s; position: relative; padding-left: 44px; min-height: 30px; }
.num-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .95rem;
}
.saved-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.saved-list li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 14px; }

/* ---------- Tìm kiếm ---------- */
.site-search { position: relative; margin-left: auto; margin-right: var(--space-3); }
.site-search input {
  width: 220px; min-height: 40px; padding: .4em .9em .4em 2.2em; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--bg-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%234f5b6a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 12px 50%;
  font: inherit; font-size: var(--control-fs); color: var(--ink); transition: width .2s, background-color .2s, border-color .2s;
}
.site-search input:focus { outline: none; width: 280px; background-color: #fff; border-color: var(--brand, #1554c0); box-shadow: 0 0 0 3px rgba(21, 84, 192, .18); }
.site-search-btn { display: none; }
.suggest {
  position: absolute; top: calc(100% + 6px); right: 0; width: min(380px, calc(100vw - 32px)); z-index: 60;
  list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.suggest[hidden] { display: none; }
.suggest a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); min-height: var(--tap); justify-content: center; }
.suggest a:hover, .suggest a[aria-selected="true"] { background: var(--bg-alt); text-decoration: none; }
.suggest small { color: var(--muted); font-size: var(--fs-xs); }
.suggest .suggest-all { color: var(--brand, #1554c0); font-weight: 600; }
@media (max-width: 1100px) { .site-search input { width: 170px; } .site-search input:focus { width: 220px; } }
@media (max-width: 820px) {
  .site-search { margin-right: 4px; }
  .site-search input { display: none; }
  .site-search-btn {
    display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--ink);
  }
  .site-search-btn:hover { background: var(--bg-alt); }
  .nav-toggle { width: var(--tap); height: var(--tap); }
}
.search-form { display: flex; gap: var(--space-2); max-width: 640px; margin-top: var(--space-4); }
.search-form input { flex: 1; min-width: 0; }
.search-group { margin-bottom: var(--space-6); }
.search-group > h2 { font-size: 1.15rem; display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.search-results a {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; color: var(--ink);
}
.search-results a:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.search-results strong { display: block; color: var(--brand, #1554c0); }
.search-results span { display: block; color: var(--muted); font-size: .95rem; }
.search-results mark { background: #fff1c2; color: inherit; border-radius: 2px; }

/* ---------- Cầu nối: các app cũ dùng chung hình dạng nút / ô nhập ---------- */
.qn-btn, .te-btn, .dx-btn, .qf-btn, .gp-btn {
  min-height: var(--tap); border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: .35em; line-height: 1.2;
}
.te-btn-lg, .dx-btn-lg { min-height: var(--control-h); font-size: var(--fs-md); }
/* Ô nhập trong app: chữ 16px (không bị iOS phóng to), cao tối thiểu 44px */
.te-f input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .te-f select, .te-f textarea,
.qn-form input, .qn-form select, .qn-form textarea,
.dx input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .dx select, .dx textarea,
.qf input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .qf select, .qf textarea,
.tool-form input, .tool-form select, .tool-form textarea, .pd-inline select, .pd-order input, .pd-order textarea {
  font-size: var(--control-fs); min-height: var(--tap);
}
.te-f textarea, .qn-form textarea, .dx textarea, .qf textarea, .tool-form textarea, .pd-order textarea { min-height: 96px; }
.chip { min-height: var(--tap); }
.chips--small .chip, .md-faces .chip { min-height: 32px; }

/* Tiện ích */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hero h1, .lp-hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.header-inner { gap: var(--space-2); }
.form-card .field-label { display: block; font-weight: 600; font-size: .95rem; color: var(--ink); margin-bottom: 6px; }
.form-card .choice-grid { margin-bottom: 0; }
.choice-grid.te-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
