*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green-main: #0a9b4a;
  --green-dark: #06753a;
  --green-light: #e6f7ef;
  --text-main: #0b1f15;
  --text-muted: #5c6f65;
  --bg-body: #f4faf7;
  --white: #ffffff;
  --border-soft: #d7e8dd;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.08);
  --radius-xl: 18px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--bg-body);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to right, #0aa650, #0a8a45);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.logo {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav a {
  color: var(--white);
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.nav a:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Lang switch */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px;
  border-radius: 999px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--white);
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0.8;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.lang-btn .flag {
  font-size: 0.9rem;
}

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

.btn-nav {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  font-weight: 600;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-secondary {
  border-style: dashed;
  opacity: 0.9;
}

.btn-user {
  display: inline-flex;
  align-items: center;
}

.btn-user .user-name {
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.btn-primary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-main), var(--green-dark));
  color: var(--white);
  box-shadow: 0 14px 30px rgba(7, 132, 66, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(7, 132, 66, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(4, 102, 47, 0.4);
  color: var(--green-dark);
}

.btn-outline:hover {
  background: rgba(230, 247, 239, 0.9);
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* Hero */
.hero {
  padding: 42px 0 36px;
  background: radial-gradient(circle at top left, #13b15b 0, #0a8c46 35%, #044525 80%);
  color: var(--white);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.hero-text h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-text p {
  font-size: 1.02rem;
  opacity: 0.96;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.hero-highlight {
  list-style: none;
  font-size: 0.95rem;
}

.hero-highlight li + li {
  margin-top: 6px;
}

/* Hero card */
.hero-card {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-main);
  border-radius: 22px;
  padding: 20px 18px;
  box-shadow: var(--shadow-soft);
}

.hero-card h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

/* Range & summary inside hero card */
.range-group {
  margin-bottom: 14px;
}

.range-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text-main);
}

.range-note {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.range-value {
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--green-dark);
}

input[type="range"] {
  width: 100%;
  cursor: pointer;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: #dfeee6;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-main);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 3px rgba(10, 155, 74, 0.35);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-main);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 3px rgba(10, 155, 74, 0.35);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #dfeee6;
}

.hero-summary {
  list-style: none;
  margin: 10px 0 12px;
  font-size: 0.9rem;
}

.hero-summary li + li {
  margin-top: 6px;
}

.hero-summary span {
  color: var(--text-muted);
}

.hero-summary strong {
  font-weight: 700;
}

.hero-card-note {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Sections */
.section {
  padding: 48px 0;
}

.section-light {
  background: var(--green-light);
}

.section-title {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 24px;
}

/* Cards & grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 18px 16px;
  border: 1px solid rgba(215, 232, 221, 0.9);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.03);
}

.card h3 {
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.step {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 18px 16px;
  border: 1px solid rgba(215, 232, 221, 0.9);
  position: relative;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--green-main);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 10px;
}

.step h3 {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.step p {
  font-size: 0.94rem;
  color: var(--text-muted);
}

/* Calculator */
.calculator {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: flex-start;
}

.form {
  background: var(--white);
  padding: 18px 16px;
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-soft);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #c7dbcf;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  background: #f9fcfa;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--green-main);
  box-shadow: 0 0 0 1px rgba(10, 155, 74, 0.2);
  background: #ffffff;
}

.form-note {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-success {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--green-dark);
  font-weight: 600;
}

.calculator-result {
  background: var(--white);
  padding: 18px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.04);
  font-size: 0.95rem;
}

.calculator-result h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.result-list {
  list-style: none;
  margin: 8px 0 10px;
}

.result-list li + li {
  margin-top: 6px;
}

.result-list span {
  color: var(--text-muted);
}

.result-list strong {
  font-weight: 700;
}

.hidden {
  display: none;
}

/* Apply section */
.apply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: flex-start;
}

.apply-text {
  padding-right: 12px;
}

.apply-list {
  list-style: none;
  margin-top: 14px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.apply-list li + li {
  margin-top: 6px;
}

/* Footer */
.footer {
  background: #032516;
  color: rgba(255, 255, 255, 0.82);
  padding: 18px 0 16px;
  font-size: 0.85rem;
}

.footer-inner {
  text-align: center;
}

.footer-sub {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.7);
}

.footer-sub.small {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Floating support button */
.support-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  border-radius: 999px;
  border: none;
  /* chuyển sang dạng nút tròn chứa icon */
  width: 56px;
  height: 56px;
  padding: 0;
  background: linear-gradient(135deg, #0a9b4a, #06753a);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-fab-logo {
  max-width: 70%;
  max-height: 70%;
  display: block;
  object-fit: contain;
}

.support-fab:hover {
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 900px) {
  .hero-inner,
  .calculator,
  .apply {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding-top: 30px;
  }

  .hero-inner {
    gap: 24px;
  }

  .apply-text {
    padding-right: 0;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .nav {
    flex-wrap: wrap;
    gap: 10px;
  }

  .grid-3,
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-text h1 {
    font-size: 2rem;
  }
}

@media (max-width: 520px) {
  .hero-actions {
    flex-direction: column;
  }

  .btn-outline {
    width: 100%;
    justify-content: center;
  }
}


/* ==== Disbursement board (replaces old calculator) ==== */

.disb-section {
  padding: 40px 0 60px;
  background: radial-gradient(circle at top left, #0aa6501c, transparent 55%),
              radial-gradient(circle at bottom right, #0aa65020, transparent 55%),
              #f5faf7;
}

.disb-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.disb-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0b2817;
}

.disb-subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: #5b7263;
}

.disb-card {
  margin-top: 18px;
  border-radius: 20px;
  padding: 16px 12px 10px;
  background: linear-gradient(135deg, #0aa650, #06753a);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.18);
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.disb-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.25), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(255, 255, 255, 0.18), transparent 55%);
  opacity: 0.7;
  pointer-events: none;
}

.disb-card-header,
.disb-list-wrap {
  position: relative;
  z-index: 1;
}

.disb-card-header {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr;
  gap: 12px;
  padding: 4px 8px 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.disb-list-wrap {
  max-height: 220px;
  overflow: hidden;
  margin-top: 4px;
}

.disb-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.disb-item {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  margin-bottom: 4px;
  background: rgba(3, 24, 13, 0.18);
  backdrop-filter: blur(4px);
  transform: translateY(8px);
  opacity: 0;
  animation: disb-fade-in 0.35s ease forwards;
}

.disb-item:nth-child(odd) {
  background: rgba(3, 24, 13, 0.26);
}

.disb-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

.disb-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff, #caeed8);
  color: #0a7b3b;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.disb-user-id {
  font-weight: 600;
}

.disb-amount {
  font-weight: 600;
  font-size: 0.98rem;
  text-align: left;
}

.disb-status-pill {
  justify-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(8, 38, 16, 0.9);
  border: 1px solid rgba(177, 247, 205, 0.7);
  color: #c5ffe0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.disb-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #3cf58a;
}

/* animation khi list scroll */
.disb-item-leaving {
  animation: disb-leave 0.3s ease forwards;
}

@keyframes disb-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes disb-leave {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .disb-card-header,
  .disb-item {
    grid-template-columns: 1.6fr 1.1fr;
  }
  .disb-card-header span:nth-child(3),
  .disb-item span:nth-child(3) {
    display: none;
  }
  .disb-section {
    padding: 28px 0 40px;
  }
}

/* ===== Header đẹp hơn trên mobile ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 0;
    gap: 8px;
  }

  .logo {
    font-size: 1.1rem;
  }

  .header-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Cho menu nằm trên, chuyển ngôn ngữ nằm dưới để đỡ chật */
  .lang-switch {
    order: 2;
  }

  .nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px 16px;
  }

  .nav a {
    font-size: 0.9rem;
    padding: 2px 0;
  }

  /* Nút user đẩy về bên phải hàng */
  .auth-area {
    margin-left: auto;
  }

  .btn-nav {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .btn-user .user-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Màn nhỏ hơn nữa: tối ưu spacing + size */
@media (max-width: 480px) {
  .header-inner {
    padding: 8px 0;
  }

  .logo {
    font-size: 1rem;
  }

  .lang-switch {
    gap: 4px;
  }

  .lang-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .lang-btn .flag {
    font-size: 0.8rem;
  }

  .btn-user .user-name {
    max-width: 80px;
  }
}
