/* ===== SumCrafter — KHỐI DÙNG CHUNG =====
   Design system theo đúng bản mockup đã duyệt:
   pine đậm #0B2422 / hổ phách #E8A93D / teal #1F9E8E / nền kem #FAF8F1.
   Sửa 1 lần ở đây, mọi trang tự cập nhật. CẤM copy CSS sang từng trang. */
:root {
  --pine: #0B2422;
  --pine-2: #0E3B2E;
  --amber: #E8A93D;
  --amber-btn: #F0A93B;
  --amber-dark: #B97E1F;
  --teal: #1F9E8E;
  --teal-dark: #167A6E;
  --bg: #FAF8F1;
  --card: #FFFFFF;
  --mint: #EAF5F0;
  --ink: #101828;
  --muted: #66707A;
  --border: #E8E2D2;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 22px; }

/* ---------- Header (nền pine đậm, đúng mockup) ---------- */
.site-header { background: var(--pine); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800; font-size: 19px; white-space: nowrap; }
.brand img { height: 32px; width: 32px; }
.brand .w-sum { color: #fff; }
.brand .w-crafter { color: var(--amber); }
.main-nav { display: flex; gap: 24px; flex: 1; }
.main-nav a { color: #D5E2DC; text-decoration: none; font-size: 14.5px; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { color: #fff; }
.header-search { display: flex; }
.header-search input {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: #fff; border-radius: 9px; padding: 8px 14px; font-size: 13.5px; width: 190px;
}
.header-search input::placeholder { color: #8FA39B; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer { background: var(--pine); color: #9DB3AA; margin-top: 70px; padding: 44px 0 26px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 28px; }
.footer-col strong { display: block; color: #fff; font-size: 14px; margin-bottom: 12px; }
.footer-col a { display: block; color: #9DB3AA; text-decoration: none; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Hero trang chủ (đúng mockup) ---------- */
.hero { text-align: center; padding: 54px 0 10px; }
.hero h1 { font-size: clamp(30px, 5vw, 42px); font-weight: 800; letter-spacing: -0.5px; margin-bottom: 14px; }
.hero .sub { color: var(--muted); font-size: 16.5px; max-width: 620px; margin: 0 auto 26px; }
.hero-search { display: flex; max-width: 560px; margin: 0 auto; gap: 10px; }
.hero-search input {
  flex: 1; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; background: #fff;
}
.hero-search button {
  background: var(--teal); color: #fff; border: 0; border-radius: 12px;
  padding: 0 30px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.hero-search button:hover { background: var(--teal-dark); }
.popular { margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.popular .pill {
  display: inline-block; border: 1px solid #BFD9D2; color: var(--teal-dark); background: #fff;
  border-radius: 999px; padding: 5px 14px; margin: 4px 4px; text-decoration: none; font-weight: 600;
}
.popular .pill:hover { background: var(--mint); }

/* ---------- Card flagship ---------- */
.flagship {
  background: var(--mint); border: 1px solid #D5E9E1; border-radius: 18px;
  padding: 30px 34px; margin: 34px 0 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.flag-badge {
  display: inline-block; background: #F6C667; color: #5C3D0A; font-size: 11px; font-weight: 800;
  letter-spacing: 1px; padding: 4px 12px; border-radius: 6px; margin-bottom: 12px;
}
.flagship h2 { font-size: 24px; margin-bottom: 8px; }
.flagship p { color: var(--muted); font-size: 15px; max-width: 520px; }
.flag-right { text-align: right; }
.flag-num { font-size: 36px; font-weight: 800; letter-spacing: -0.5px; }
.flag-cap { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.btn-amber {
  display: inline-block; background: var(--amber-btn); color: #3D2A08; font-weight: 800;
  border: 0; padding: 13px 26px; border-radius: 11px; cursor: pointer; font-size: 15px; text-decoration: none;
}
.btn-amber:hover { background: var(--amber); }

/* ---------- Browse by goal ---------- */
.section { padding: 34px 0 6px; }
.section h2 { font-size: 23px; font-weight: 800; margin-bottom: 18px; }
.goal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.goal-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-decoration: none; color: var(--ink); display: block;
  transition: transform .15s, box-shadow .15s;
}
.goal-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(11,36,34,.1); }
.goal-icon {
  width: 42px; height: 42px; border-radius: 11px; background: var(--mint); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; margin-bottom: 12px;
}
.goal-card h3 { font-size: 16.5px; color: var(--teal-dark); margin-bottom: 6px; }
.goal-card p { font-size: 13.5px; color: var(--muted); }

/* ---------- Most used ---------- */
.used-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.used-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 22px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink);
}
.used-row:last-child { border-bottom: 0; }
.used-row:hover { background: #FDFAF3; }
.used-name { font-weight: 600; font-size: 15px; }
.used-vol { color: var(--teal-dark); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.used-open { color: var(--teal-dark); font-size: 14px; font-weight: 600; white-space: nowrap; }

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--pine); border-radius: 18px; padding: 34px 36px; margin: 40px 0 0;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.newsletter h3 { color: #fff; font-size: 21px; margin-bottom: 6px; }
.newsletter p { color: #9DB3AA; font-size: 14px; }
.news-form { display: flex; gap: 10px; }
.news-form input {
  padding: 13px 18px; border: 0; border-radius: 11px; font-size: 14.5px; width: 240px;
}
.news-form button {
  background: var(--amber-btn); color: #3D2A08; border: 0; border-radius: 11px;
  padding: 0 26px; font-weight: 800; font-size: 14.5px; cursor: pointer;
}

/* ---------- Trang tool ---------- */
.calc-app {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px; margin: 26px 0 34px; box-shadow: 0 8px 24px rgba(11,36,34,.06);
}
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: var(--bg); font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Form liên hệ ---------- */
.contact-form { margin: 22px 0 30px; }
.contact-form textarea { resize: vertical; min-height: 120px; }
.form-status { font-size: 14.5px; font-weight: 600; margin-top: 12px; min-height: 22px; }
.form-status.ok { color: var(--teal-dark); }
.form-status.err { color: #B3261E; }
.contact-form .btn:disabled { opacity: .6; cursor: wait; }
.result-panel { background: var(--pine); color: #fff; border-radius: var(--radius); padding: 26px; }
.result-panel .big { font-size: 38px; font-weight: 800; color: var(--amber); margin: 6px 0; letter-spacing: -0.5px; }
.result-panel .row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.14); font-size: 14px; }
.result-panel .row span:last-child { font-weight: 700; text-align: right; }
.btn { display: inline-block; background: var(--amber-btn); color: #3D2A08; font-weight: 800; border: 0; padding: 13px 28px; border-radius: 11px; cursor: pointer; font-size: 16px; text-decoration: none; }
canvas.chart { width: 100%; height: 220px; margin-top: 16px; background: rgba(255,255,255,.06); border-radius: 10px; }

/* ---------- Nội dung bài viết ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: 23px; margin: 38px 0 12px; letter-spacing: -0.3px; }
.prose h3 { font-size: 18px; margin: 24px 0 8px; }
.prose p, .prose li { margin-bottom: 12px; }
.prose ul, .prose ol { padding-left: 24px; }
.formula {
  background: var(--mint); border-left: 4px solid var(--amber); padding: 16px 20px;
  border-radius: 0 10px 10px 0; font-family: Georgia, serif; font-size: 18px; margin: 20px 0;
}
.faq { margin: 14px 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.faq summary { padding: 16px 20px; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--amber-dark); font-size: 20px; font-weight: 800; }
.faq[open] summary::after { content: "–"; }
.faq .a { padding: 0 20px 16px; color: var(--muted); }
.breadcrumb { font-size: 13px; color: var(--muted); margin: 22px 0 6px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal-dark); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink); display: block;
  transition: transform .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(11,36,34,.1); }
.tool-card h3, .tool-card .card-h { font-size: 16px; margin: 8px 0 6px; color: var(--teal-dark); }
.tool-card p { font-size: 13.5px; color: var(--muted); }
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  background: #F7DEA8; color: #5C3D0A; padding: 3px 10px; border-radius: 6px; margin-bottom: 8px;
}
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.disclaimer { font-size: 13px; color: var(--muted); background: #F5EFE0; border-radius: 10px; padding: 14px 18px; margin-top: 34px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .calc-grid { grid-template-columns: 1fr; }
  .goal-grid { grid-template-columns: 1fr; }
  .flagship { grid-template-columns: 1fr; }
  .flag-right { text-align: left; }
  .newsletter { grid-template-columns: 1fr; }
  .news-form { flex-direction: column; }
  .news-form input { width: 100%; }
  .main-nav {
    display: none; position: absolute; top: 62px; left: 0; right: 0;
    background: var(--pine); flex-direction: column; padding: 14px 22px 20px; gap: 14px;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; padding: 10px 6px; line-height: 1; }
  .header-search { display: none; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-search { flex-direction: column; }
  /* Nút bấm trên mobile: to hơn, dễ chạm (chuẩn touch ≥44px) */
  .nav-toggle { font-size: 30px; padding: 12px 8px; }
  .hero-search input { padding: 16px 18px; font-size: 16px; }
  .hero-search button { padding: 16px 30px; font-size: 16px; }
  .popular { font-size: 14.5px; }
  .popular .pill { padding: 10px 20px; font-size: 15px; margin: 6px 5px; }
  .btn, .btn-amber { padding: 16px 28px; font-size: 16px; min-height: 48px; }
  .news-form input { padding: 16px 18px; font-size: 16px; }
  .news-form button { padding: 16px 26px; font-size: 16px; }
  .field input, .field select { padding: 14px; font-size: 16px; }
  .used-row { padding: 18px 22px; }
}

/* Dòng ngày cập nhật bài viết */
.meta-line { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }

/* ===== Thanh Export & Share (dưới panel kết quả mỗi tool) ===== */
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.ra-btn {
  font-size: 15px; font-weight: 600; padding: 12px 18px; min-height: 48px;
  border: 2px solid var(--teal); border-radius: 10px; background: #fff; color: var(--teal-dark);
  cursor: pointer; transition: background .15s, color .15s;
}
.ra-btn:hover { background: var(--teal); color: #fff; }
.ra-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.share-menu { position: absolute; display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 50; min-width: 180px; }
.share-menu a { padding: 10px 14px; border-radius: 8px; color: var(--ink); font-size: 15px; }
.share-menu a:hover { background: var(--cream); }
.result-actions .ra-btn:last-child { position: relative; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--pine); color: #fff; padding: 13px 22px; border-radius: 12px;
  font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.print-header { display: none; }

/* ===== In ấn: báo cáo 2 cột có họa tiết thương hiệu ===== */
.print-report { display: none; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body > *:not(.print-report) { display: none !important; }
  body { background: #fff; }
  .print-report { display: block !important; font-family: Arial, Helvetica, sans-serif; color: #14201c; }

  /* Header: pine + họa tiết chấm + Σ mờ */
  .pr-head { position: relative; overflow: hidden; background: #0B2422;
    background-image: radial-gradient(rgba(232,169,61,.14) 1.6px, transparent 1.7px);
    background-size: 22px 22px; border-radius: 12px; padding: 20px 26px; margin-bottom: 20px; }
  .pr-wm { position: absolute; right: 6px; top: -46px; font-size: 190px; line-height: 1;
    color: rgba(232,169,61,.13); font-weight: 800; pointer-events: none; }
  .pr-brand { font-weight: 800; font-size: 15px; letter-spacing: .4px; position: relative; }
  .pr-brand .pr-sigma { color: #E8A93D; font-size: 20px; }
  .pr-brand .pr-w1 { color: #FAF8F1; }
  .pr-brand .pr-w2 { color: #E8A93D; }
  .pr-title { color: #FAF8F1; font-size: 25px; font-weight: 800; margin: 6px 0 3px; position: relative; }
  .pr-meta { font-size: 12px; color: #9fc4b9; position: relative; }

  /* 2 cột */
  .pr-cols { overflow: hidden; }
  .pr-col-l { float: left; width: 37%; }
  .pr-col-r { float: right; width: 60%; }

  .pr-section { margin-bottom: 18px; page-break-inside: avoid; }
  .pr-h { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.3px;
    color: #0E3B2E; border-bottom: 2px solid #E8A93D; padding-bottom: 5px; margin-bottom: 10px; }

  /* Bảng */
  .pr-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  .pr-table th, .pr-table td { border: 1px solid #D8E2DD; padding: 6px 9px; text-align: left; vertical-align: top; }
  .pr-table th { background: #0E3B2E; color: #FAF8F1; font-weight: 700; }
  .pr-inputs th { width: 55%; font-weight: 600; }
  .pr-sched th { width: auto; }
  .pr-sched td, .pr-sched th { text-align: right; }
  .pr-sched td:first-child, .pr-sched th:first-child { text-align: left; }
  .pr-sched tr:nth-child(even) td { background: #F4F8F6; }

  /* Thẻ kết quả: mint + Σ mờ */
  .pr-result-card { position: relative; overflow: hidden; background: #EAF4EF;
    border: 1px solid #CBE3D8; border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
  .pr-wm2 { position: absolute; right: 4px; top: -28px; font-size: 120px; line-height: 1;
    color: rgba(14,59,46,.07); font-weight: 800; pointer-events: none; }
  .pr-big { position: relative; font-size: 33px; font-weight: 800; color: #0E3B2E; }
  .pr-sub { position: relative; font-size: 13px; color: #41554d; margin-top: 4px; }

  /* Hộp công thức: nền kem hổ phách */
  .pr-formula { font-size: 13px; line-height: 1.65; background: #FFF8EA;
    border: 1px solid #F0DCAE; border-left: 5px solid #E8A93D; border-radius: 0 10px 10px 0; padding: 11px 14px; }
  .pr-formula sup { font-size: 0.75em; }

  .pr-foot { font-size: 10.5px; color: #8a978f; border-top: 1px solid #D8E2DD;
    padding-top: 8px; margin-top: 24px; clear: both; }
  .pr-foot::first-letter { color: #E8A93D; font-weight: 800; }
}

/* Bảng dữ liệu trong nội dung (tool & guide) */
.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.data-table th, .data-table td { border: 1px solid #ddd; padding: 8px 10px; text-align: left; }
.data-table th { background: #EEF4F1; font-weight: 700; }
