/* ==========================================================================
  DocMoney — Design tokens
   Concept: the Thai bank passbook (สมุดบัญชีธนาคาร) — a printed ledger
   everyone recognizes — reimagined as a web app for daily รายรับ-รายจ่าย
   ========================================================================== */

:root {
  --bg: #f2f7f5;
  --paper: #fbf7ec;
  --ink: #12241f;
  --ink-soft: #4b6259;
  --primary: #1f7a5c;
  --primary-dark: #14523d;
  --gold: #c9973e;
  --expense: #d9564f;
  --line: rgba(18, 36, 31, 0.14);
  --line-soft: rgba(18, 36, 31, 0.08);
  --shadow: 0 20px 50px -25px rgba(18, 36, 31, 0.35);

  --font-display: "Prompt", "Noto Sans Thai", sans-serif;
  --font-body: "Sarabun", "Noto Sans Thai", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

.container {
  max-width: 1160px;
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 768px) {
  .topbar {
    top: 12px;
    width: calc(100% - 24px); /* ปรับความกว้างให้มีขอบซ้ายขวาสวยงาม */
  }

  .topbar-inner {
    flex-wrap: nowrap; /* บังคับให้อยู่บรรทัดเดียวกันเสมอ */
    justify-content: space-between; /* แยกโลโก้ซ้าย เมนูขวา */
    gap: 12px;
    padding: 10px 16px; /* ลดระยะขอบด้านในลงเล็กน้อยสำหรับมือถือ */
  }

  .topbar-shell {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .nav-links {
    display: none; /* ซ่อนเมนูหลักแบบข้อความ (ควรใช้รวมในเมนู Dropdown แทน) */
  }

  .profile-name,
  .profile-caret {
    display: none; /* ซ่อนชื่อและลูกศรให้เหลือแค่รูปโปรไฟล์ เพื่อประหยัดพื้นที่ */
  }

  .profile-chip {
    padding: 4px; /* ปรับให้ปุ่มโปรไฟล์เป็นทรงกลมเล็กๆ */
    border-radius: 50%;
  }

  .brand {
    font-size: 18px; /* ปรับขนาดโลโก้ลงเล็กน้อยไม่ให้เบียดเกินไป */
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  /* ปรับให้เมนูย่อยที่กางออกมา (Dropdown) แสดงผลพอดีกับขอบหน้าจอขวา */
  .topbar-menu-panel {
    right: 0;
    transform: none;
    min-width: 240px;
  }
}

/* แสดงปุ่ม Hamburger เฉพาะบนมือถือ */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  padding: 4px 8px;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block; /* เปิดให้แสดงปุ่มบนมือถือ */
  }

  .topbar-nav {
    display: none; /* สั่งซ่อนเมนูที่กางอยู่[cite: 1] */
    position: absolute;
    top: 60px; /* ระยะห่างจากด้านบน ให้อยู่ใต้ Topbar พอดี[cite: 1] */
    left: 0;
    width: 100%;
    flex-direction: column; /* เปลี่ยนให้ปุ่มเรียงจากบนลงล่างตอนเปิด Dropdown[cite: 1] */

    /* สิ่งที่แนะนำให้เพิ่ม: สีพื้นหลัง กรอบ และ Padding เพื่อให้ Dropdown อ่านง่ายขึ้น */
    background: rgba(11, 18, 15, 0.96);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 26px 50px -28px rgba(0, 0, 0, 0.6);
  }

  /* คลาสสำหรับตอนที่ผู้ใช้กดปุ่ม Hamburger ให้โชว์ Dropdown[cite: 1] */
  .topbar-nav.show-dropdown {
    display: flex;
  }
}
/* ---------------- Top bar ---------------- */

.topbar {
  position: sticky;
  top: 18px;
  z-index: 40;
  width: calc(100% - 32px);
  max-width: 1040px;
  margin: 0 auto;
  background: rgba(15, 27, 23, 0.78);
  color: #fff;
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 18px 45px -24px rgba(10, 16, 14, 0.55);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px 12px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.brand-mark svg {
  width: 18px;
  height: 18px;
}

.nav-links {
  display: flex;
  gap: 32px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.78);
}
.nav-links a:hover {
  color: #fff;
}

.topbar-shell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-nav a {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 999px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.topbar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.logout-link {
  color: #ffd6d6;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}
.profile-chip:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-caret {
  width: 14px;
  height: 14px;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-caret svg {
  width: 14px;
  height: 14px;
}

.topbar-menu {
  position: relative;
}
.topbar-menu summary {
  list-style: none;
}
.topbar-menu summary::-webkit-details-marker {
  display: none;
}
.topbar-menu[open] .profile-chip {
  background: rgba(255, 255, 255, 0.14);
}

.topbar-menu-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 280px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(11, 18, 15, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 26px 50px -28px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; gap: 8px;
}

.topbar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.topbar-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}
.topbar-menu-danger {
  color: #ffd6d6;
}

.menu-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}
.menu-icon svg {
  width: 16px;
  height: 16px;
}
.topbar-menu-panel .topbar-menu-item:last-child .menu-icon {
  background: rgba(217, 86, 79, 0.16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(31, 122, 92, 0.7);
}
.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--primary);
  background: rgba(31, 122, 92, 0.06);
}

.btn-login {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.btn-login:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-pill {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body {
  padding-top: 22px;
}

.btn-block {
  width: 100%;
}

/* ---------------- Hero ---------------- */

.hero {
  padding: 76px 0 60px;
}

.hero-inner {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
  background: rgba(31, 122, 92, 0.1);
  border: 1px solid rgba(31, 122, 92, 0.25);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.25;
  margin: 0 0 20px;
  color: var(--ink);
}
.hero h1 span {
  color: var(--primary);
}

.hero p.lead {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 0 32px;
}

.hero-ctas {
  display: flex;
  gap: 14px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 32px;
  border-top: 1px solid var(--line-soft);
  padding-top: 22px;
}
.hero-stats div strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--primary-dark);
}
.hero-stats div span {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------------- Passbook signature illustration ---------------- */

.passbook-wrap {
  position: relative;
  perspective: 1200px;
}

.passbook {
  background: var(--paper);
  border-radius: 6px 14px 14px 6px;
  box-shadow:
    var(--shadow),
    inset -1px 0 0 rgba(0, 0, 0, 0.05);
  padding: 30px 30px 26px;
  position: relative;
  transform: rotate(-2deg);
  animation: float 6s ease-in-out infinite;
  border: 1px solid rgba(18, 36, 31, 0.08);
}

.passbook::before {
  /* spiral binding edge */
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 14px;
  background-image: radial-gradient(
    circle at 50% 50%,
    var(--bg) 2.5px,
    transparent 2.6px
  );
  background-size: 14px 16px;
  background-repeat: repeat-y;
  border-right: 1px dashed var(--line);
}

@keyframes float {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0);
  }
  50% {
    transform: rotate(-2deg) translateY(-10px);
  }
}

.passbook-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-left: 14px;
}
.passbook-header .bank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 15px;
}
.passbook-header .acct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}
.stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  transform: rotate(8deg);
  opacity: 0.8;
  line-height: 1.1;
}

.ledger {
  padding-left: 14px;
  border-top: 1px dashed var(--line);
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  opacity: 0;
  transform: translateX(-6px);
  animation: rowIn 0.5s ease forwards;
}
.ledger-row:nth-child(1) {
  animation-delay: 0.3s;
}
.ledger-row:nth-child(2) {
  animation-delay: 0.6s;
}
.ledger-row:nth-child(3) {
  animation-delay: 0.9s;
}
.ledger-row:nth-child(4) {
  animation-delay: 1.2s;
}

@keyframes rowIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ledger-row .date {
  color: var(--ink-soft);
}
.ledger-row .desc {
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 14px;
}
.ledger-row .amt.in {
  color: var(--primary);
}
.ledger-row .amt.out {
  color: var(--expense);
}

.ledger-balance {
  padding: 18px 0 4px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ledger-balance .label {
  font-size: 13px;
  color: var(--ink-soft);
}
.ledger-balance .value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 26px;
  color: var(--primary-dark);
}

.passbook-shadow-card {
  position: absolute;
  inset: 18px -18px -18px 18px;
  background: rgba(31, 122, 92, 0.08);
  border-radius: 6px 14px 14px 6px;
  z-index: -1;
}

/* ---------------- Section framing ---------------- */

.section {
  padding: 80px 0;
}
.section-alt {
  background: #fff;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.section-head {
  max-width: 620px;
  margin: 0 0 44px;
}
.section-head .eyebrow {
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 12px;
}
.section-head p {
  color: var(--ink-soft);
  font-size: 16px;
  margin: 0;
}

/* ---------------- Feature groups ---------------- */

.group {
  margin-bottom: 56px;
}
.group:last-child {
  margin-bottom: 0;
}

.group-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.group-title h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}
.group-title .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.card-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
}

.feature-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 22px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px -20px rgba(18, 36, 31, 0.3);
  border-color: rgba(31, 122, 92, 0.3);
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(31, 122, 92, 0.1);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--primary-dark);
}
.feature-icon svg {
  width: 20px;
  height: 20px;
}
.feature-card h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}
.feature-card p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------------- CTA band ---------------- */

.cta-band {
  background: var(--primary-dark);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-band h2 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 8px;
}
.cta-band p {
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  max-width: 420px;
}
.cta-band .btn-primary {
  background: #fff;
  color: var(--primary-dark);
}
.cta-band .btn-primary:hover {
  background: var(--gold);
  color: #fff;
}

/* ---------------- Footer ---------------- */

footer {
  padding: 36px 0 40px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.45);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: var(--ink-soft);
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-brand .brand {
  color: var(--ink);
}
.footer-brand h4 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}
.footer-brand p {
  margin: 0;
  max-width: 420px;
  color: var(--ink-soft);
}
.footer-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-links a {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.footer-links a:hover {
  background: rgba(31, 122, 92, 0.08);
  color: var(--primary-dark);
}
.footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-buttons .btn {
  padding: 9px 14px;
  font-size: 14px;
}

@media (max-width: 768px) {
  .footer-inner {
    align-items: flex-start;
  }

  .footer-actions {
    align-items: flex-start;
    width: 100%;
  }

  .footer-buttons {
    width: 100%;
  }

  .footer-buttons .btn {
    flex: 1 1 180px;
    justify-content: center;
  }
}

/* ---------------- Login page ---------------- */

.auth-page {
  min-height: 100vh;
  /* display: grid; removed */
  /* grid-template-columns removed */
}

.auth-side {
  background: var(--primary-dark);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.auth-side .brand {
  color: #fff;
}
.auth-side .brand-mark {
  background: rgba(255, 255, 255, 0.15);
}

.auth-quote {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.5;
  max-width: 380px;
}
.auth-quote span {
  color: var(--gold);
}

.auth-mini-ledger {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  max-width: 340px;

  transform: rotate(-1deg);
  animation: float 6s ease-in-out infinite;
}
.auth-mini-ledger .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
}
.auth-mini-ledger .row:last-child {
  border-bottom: none;
}
.auth-mini-ledger .in {
  color: #8fd6b8;
}
.auth-mini-ledger .out {
  color: #f2a6a2;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-back {
  font-size: 14px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
}
.auth-back:hover {
  color: var(--primary-dark);
}

.auth-tabs {
  display: flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 30px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink-soft);
  transition:
    background 0.15s ease,
    color 0.15s ease;
  border: none;
  background: transparent;
}
.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 6px;
}
.auth-card > p {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0 0 28px;
}

.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}
.field-input {
  position: relative;
}
.field-input input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.field-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 92, 0.12);
  outline: none;
}
.field-input input.error {
  border-color: var(--expense);
}
.field-hint {
  font-size: 12.5px;
  color: var(--expense);
  margin-top: 6px;
  min-height: 1em;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
}
.toggle-pw:hover {
  color: var(--primary-dark);
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  margin-bottom: 22px;
}
.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
}
.remember input {
  accent-color: var(--primary);
}
.forgot:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 24px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 20px;
}
.auth-switch button {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 0;
}
.auth-switch button:hover {
  text-decoration: underline;
}

.form-panel {
  display: none;
}
.form-panel.active {
  display: block;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 980px) {
  .hero-inner {
    /* grid-template-columns removed */
  }
  .passbook-wrap {
    order: -1;
    max-width: 420px;
    margin: 0 auto;
  }
  .card-grid {
    /* grid-template-columns removed */
  }
  .auth-page {
    /* grid-template-columns removed */
  }
  .auth-side {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 20px;
  }
  .topbar-inner {
    padding: 14px 20px;
  }
  .nav-links {
    display: none;
  }
  .hero {
    padding: 44px 0 40px;
  }
  .hero h1 {
    font-size: 32px;
  }
  .hero-ctas {
    flex-direction: column;
  }
  .hero-ctas .btn {
    width: 100%;
  }
  .hero-stats {
    gap: 20px;
    flex-wrap: wrap;
  }
  .card-grid {
    /* grid-template-columns removed */
  }
  .cta-band {
    flex-direction: column;
    text-align: center;
    padding: 36px 24px;
  }
  .section {
    padding: 56px 0;
  }
}

/* ==========================================================================
   เพิ่มเติม: ปุ่ม Google Login และจุดตกแต่งหน้า Auth เพื่อลดความโล่ง
   ========================================================================== */

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid rgba(18, 36, 31, 0.16);
  border-radius: 6px;
  padding: 11px 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
  box-shadow: 0 2px 4px rgba(18, 36, 31, 0.02);
}

.btn-google:hover {
  background: #fdfdfb;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(31, 122, 92, 0.12);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-trust-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
}

/* ==========================================================================
   DocMoney redesign refresh
   ========================================================================== */

:root {
  --bg: #eef3f1;
  --bg-soft: #f8faf9;
  --paper: #ffffff;
  --ink: #10211d;
  --ink-soft: #5f7169;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --gold: #d6a24a;
  --expense: #d65d5d;
  --line: rgba(16, 33, 29, 0.12);
  --line-soft: rgba(16, 33, 29, 0.07);
  --shadow: 0 24px 60px -30px rgba(16, 33, 29, 0.28);
  --shadow-soft: 0 18px 40px -28px rgba(16, 33, 29, 0.18);
}

body {
  min-height: 100vh;
  padding-top: 24px;
  background:
    radial-gradient(
      circle at 10% 0%,
      rgba(15, 118, 110, 0.12),
      transparent 28%
    ),
    radial-gradient(
      circle at 100% 12%,
      rgba(214, 162, 74, 0.14),
      transparent 26%
    ),
    linear-gradient(180deg, #f8fbfa 0%, var(--bg) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(24px);
}

body::before {
  left: -140px;
  top: 180px;
  background: rgba(15, 118, 110, 0.08);
}

body::after {
  right: -140px;
  top: 80px;
  background: rgba(214, 162, 74, 0.08);
}

.topbar {
  max-width: 1120px;
  background: rgba(14, 25, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 42px -26px rgba(8, 14, 12, 0.55);
}

.brand {
  font-size: 18px;
  letter-spacing: 0.01em;
}

.brand-mark {
  border-radius: 14px;
}

.container {
  max-width: 1180px;
}

header.topbar ~ main.container {
  padding-top: 48px;
}

.card-surface,
.page-head,
.dashboard-hero,
.recent-card,
.quick-panel,
.chart-card,
.summary-card,
.insight-card,
.tx-form,
.tx-list-card,
.auth-card-shell,
.feature-card,
.cta-band {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 33, 29, 0.08);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(150%);
  padding: 24px; /* หรือปรับเป็น 32px ให้โปร่งตาขึ้น */
}

.btn {
  border-radius: 999px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0c5f5a);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.72);
}

.hero,
.section,
.dashboard-page,
.transaction-page {
  position: relative;
}

.hero {
  padding-top: 72px;
}

.hero h1,
.section-head h2,
.section-headline h2,
.dashboard-hero h1,
.page-head h1,
.auth-title {
  letter-spacing: -0.02em;
}

.hero p.lead,
.dashboard-hero .lead,
.page-head .lead,
.auth-lead,
.section-head p,
.section-headline p {
  color: var(--ink-soft);
}

.passbook {
  background: linear-gradient(180deg, #fffaf0 0%, #f7f1df 100%);
  box-shadow: var(--shadow);
}

.passbook-shadow-card {
  background: rgba(15, 118, 110, 0.1);
}

.section-alt {
  background: rgba(255, 255, 255, 0.38);
}

.feature-card:hover,
.summary-card:hover,
.insight-card:hover,
.quick-link:hover,
.transaction-row:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

.dashboard-page {
  padding-bottom: 72px;
}

.dashboard-hero,
.page-head {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 24px;
  align-items: stretch;
  padding: 32px;
  border-radius: var(--radius-lg);
}

.page-head.history-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, #f7fcf7 0%, #ffffff 100%);
  border: 1px solid rgba(18, 36, 31, 0.08);
  box-shadow: 0 22px 42px rgba(8, 14, 12, 0.08);
  backdrop-filter: blur(18px);
}

.page-head.history-banner > div:first-child {
  flex: 1;
  min-width: 300px;
}

.page-head.history-banner h1 {
  margin: 8px 0;
  font-size: 2rem;
  line-height: 1.05;
  color: #12241f;
}

.page-head.history-banner .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: rgba(15, 118, 110, 0.12);
  color: #114b32;
  font-weight: 600;
}

.page-head.history-banner .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #359a7a;
}

.page-head.history-banner .lead {
  color: #42524b;
  opacity: 0.92;
  margin-bottom: 0;
}

.page-head.history-banner .page-summary {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 16px;
  flex: 2;
  min-width: 520px;
}

.page-head.history-banner .summary-wrapper {
  position: relative;
  min-height: 80px;
}

.page-head.history-banner .summary-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 18px;
  border: 1px solid rgba(18, 36, 31, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  box-sizing: border-box;
  cursor: pointer;
  overflow: hidden;
  min-height: 100%;
  backdrop-filter: blur(12px);
}

.page-head.history-banner .summary-card:hover {
  width: max-content;
  min-width: 100%;
  right: auto;
  background-color: #ffffff !important;
  border-color: rgba(18, 36, 31, 0.15) !important;
  box-shadow: 0 12px 28px rgba(18, 36, 31, 0.14);
  z-index: 10;
  transform: translateY(-4px);
}

.page-head.history-banner .summary-card small {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  margin-bottom: 4px;
}

.page-head.history-banner .amount-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.page-head.history-banner .amount-value .full-val {
  display: none;
}

.page-head.history-banner .summary-card:hover .amount-value .short-val {
  display: none;
}

.page-head.history-banner .summary-card:hover .amount-value .full-val {
  display: inline;
}

@media (max-width: 1200px) {
  .page-head.history-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head.history-banner .page-summary {
    width: 100%;
    /* grid-template-columns removed */
  }
}

@media (max-width: 576px) {
  .page-head.history-banner .page-summary {
    /* grid-template-columns removed */
    min-width: 0;
  }
}

.dashboard-profile-card {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(15, 118, 110, 0.08),
    rgba(15, 118, 110, 0.03)
  );
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.profile-preview {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(
    135deg,
    rgba(15, 118, 110, 0.95),
    rgba(17, 94, 89, 0.92)
  );
  color: #fff;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-profile-card h2,
.dashboard-profile-card p {
  margin: 0;
}

.dashboard-profile-card p {
  color: var(--ink-soft);
  font-size: 14px;
}

.dashboard-insights,
.summary-grid {
  /* display: grid; removed */
  gap: 16px;
}

.dashboard-insights {
  /* grid-template-columns removed */
  margin: 18px 0 16px;
}

.insight-card,
.summary-card {
  border-radius: 24px;
  padding: 22px;
}

.insight-card strong,
.summary-card strong,
.page-summary strong,
.transaction-amount {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.insight-card strong {
  display: block;
  font-size: 24px;
  margin: 4px 0 6px;
  color: var(--ink);
}

.insight-card small,
.summary-card small,
.page-summary small,
.transaction-main small {
  color: var(--ink-soft);
}

.summary-grid {
  /* grid-template-columns removed */
  margin: 18px 0 20px;
}

.summary-card strong {
  display: block;
  font-size: 34px;
  margin: 6px 0 4px;
}

.summary-card.income-card strong,
.income-text,
.tx-pill.is-income {
  color: var(--primary);
}

.summary-card.expense-card strong,
.expense-text,
.tx-pill.is-expense {
  color: var(--expense);
}

.summary-card.balance-card strong {
  color: var(--primary-dark);
}

.dashboard-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  align-items: start;
}

.chart-card,
.quick-panel,
.recent-card,
.tx-form,
.tx-list-card {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.mini-chart {
  /* display: grid; removed */
  gap: 14px;
}

.mini-chart-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  align-items: center;
}

.mini-chart-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.mini-bars {
  display: flex; flex-direction: column; gap: 8px;
}

.mini-bar {
  min-height: 12px;
  border-radius: 999px;
}

.mini-bar.income {
  background: linear-gradient(
    90deg,
    rgba(15, 118, 110, 0.95),
    rgba(15, 118, 110, 0.55)
  );
}

.mini-bar.expense {
  background: linear-gradient(
    90deg,
    rgba(214, 93, 93, 0.9),
    rgba(214, 93, 93, 0.45)
  );
}

.quick-links {
  /* display: grid; removed */
  gap: 12px;
}

.quick-link {
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 33, 29, 0.08);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.quick-link.danger-link {
  color: var(--expense);
}

.transactions-stack {
  /* display: grid; removed */
  gap: 12px;
}

.transaction-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(16, 33, 29, 0.08);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.transaction-row-grid {
  /* grid-template-columns removed */
}

.tx-pill {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 118, 110, 0.08);
  font-weight: 700;
}

.transaction-main {
  min-width: 0;
}

.transaction-main strong {
  display: block;
  margin-bottom: 2px;
}

.transaction-main span,
.transaction-main small {
  display: block;
  color: var(--ink-soft);
}

.transaction-amount {
  font-size: 18px;
  white-space: nowrap;
}

.tx-delete-form {
  margin: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(16, 33, 29, 0.08);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-soft);
}

.danger-icon:hover {
  background: rgba(214, 93, 93, 0.12);
  color: var(--expense);
}

.page-head {
  margin-bottom: 18px;
}

.page-summary {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
}

.page-summary div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 33, 29, 0.08);
}

.page-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.notice {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(16, 33, 29, 0.08);
  background: rgba(255, 255, 255, 0.75);
}

.success-notice {
  color: var(--primary-dark);
}

.error-notice,
.auth-error {
  color: #8e2f2f;
  background: rgba(214, 93, 93, 0.08);
  border-color: rgba(214, 93, 93, 0.18);
}

.transaction-layout {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  align-items: start;
}

.tx-form label {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
}

.tx-form label span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.tx-form input,
.tx-form select,
.tx-form textarea,
.auth-card input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(16, 33, 29, 0.12);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.tx-form input:focus,
.tx-form select:focus,
.tx-form textarea:focus,
.auth-card input:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
  outline: none;
}

.tx-form textarea {
  resize: vertical;
  min-height: 112px;
}

.two-cols {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
}

.compact-stack .transaction-row {
  padding: 12px 14px;
}

.auth-page {
  min-height: calc(100vh - 24px);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(17, 94, 89, 0.92)),
    radial-gradient(
      circle at top right,
      rgba(214, 162, 74, 0.14),
      transparent 30%
    );
}

.auth-side {
  background: transparent;
  padding: 60px;
}

.auth-side .brand {
  font-size: 20px;
}

.auth-quote {
  max-width: 420px;
}

.auth-mini-ledger {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.auth-main {
  background: rgba(255, 255, 255, 0.1);
  padding: 48px 24px;

  /* 1. เติม 2 บรรทัดนี้เข้าไปในปีกกาเดิม */
  position: relative;
  overflow: hidden;
}

/* 2. เอาวงแสงมาวางต่อท้าย .auth-main ได้เลย */
.auth-main::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(214, 162, 74, 0.15) 0%,
    transparent 70%
  );
  z-index: 0;
  pointer-events: none;
}

.auth-card-shell {
  max-width: 460px;
  padding: 28px;
  border-radius: 30px;

  /* 3. เติม 2 บรรทัดนี้เข้าไป */
  position: relative;
  z-index: 1;
}

.auth-panel {
  text-align: center;
  margin-top: 28px;
}

.auth-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    rgba(15, 118, 110, 0.12),
    rgba(15, 118, 110, 0.06)
  );
  color: var(--primary-dark);
  margin-bottom: 22px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 8px;
}

.auth-lead {
  margin: 0 0 30px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border-radius: 18px;
  padding: 14px 18px;
  text-decoration: none;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid rgba(16, 33, 29, 0.12);
  box-shadow: 0 8px 24px -18px rgba(16, 33, 29, 0.26);
}

.btn-google:hover {
  border-color: rgba(15, 118, 110, 0.45);
  transform: translateY(-1px);
}

.btn-google svg {
  width: 22px;
  height: 22px;
}

.auth-trust-badge {
  margin-top: 24px;
  padding-top: 18px;
  color: var(--ink-soft);
}

@media (max-width: 980px) {
  .dashboard-hero,
  .page-head,
  .dashboard-grid,
  .transaction-layout {
    /* grid-template-columns removed */
  }

  .dashboard-insights,
  .summary-grid,
  .page-summary {
    /* grid-template-columns removed */
  }

  .auth-page {
    /* grid-template-columns removed */
  }

  .auth-side {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    padding-top: 16px;
  }

  .dashboard-hero,
  .page-head,
  .chart-card,
  .quick-panel,
  .recent-card,
  .tx-form,
  .tx-list-card,
  .auth-card-shell {
    padding: 20px;
  }

  .section-headline {
    flex-direction: column;
  }

  .transaction-row,
  .transaction-row-grid {
    /* grid-template-columns removed */
  }

  .transaction-amount,
  .tx-delete-form {
    grid-column: 2;
    justify-self: start;
  }

  .transaction-row-grid .tx-delete-form {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .two-cols {
    /* grid-template-columns removed */
  }

  .hero h1 {
    font-size: 32px;
  }
}

.auth-trust-badge svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
}

/* ==========================================================================
   [สร้างใหม่] โครงสร้างสไตล์ของหน้า Dashboard (Prefix: .sm-new-db-)
   เรียกใช้ Token เดิมทั้งหมด ไม่มีผลกระทบและไม่กวนหน้าเว็บเก่าแน่นอน 100%
   ========================================================================== */

.sm-new-db-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* Header Section */
.sm-new-db-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 24px;
}
.sm-new-db-title-zone h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 8px 0;
}

.sm-new-db-filter-zone {
  display: inline-flex;
  background: rgba(18, 36, 31, 0.05);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}
.sm-new-db-time-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.sm-new-db-time-btn:hover {
  color: var(--ink);
}
.sm-new-db-time-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(18, 36, 31, 0.06);
}

/* Summary Grid Cards */
.sm-new-db-cards-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  margin-bottom: 32px;
}
.sm-new-db-summary-card {
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(18, 36, 31, 0.01);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.sm-new-db-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(18, 36, 31, 0.12);
}
.sm-new-db-summary-card .card-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sm-new-db-summary-card .card-icon-wrap svg {
  width: 22px;
  height: 22px;
}

/* Card Specific Colors */
.card-income .card-icon-wrap {
  background: rgba(31, 122, 92, 0.1);
  color: var(--primary);
}
.card-expense .card-icon-wrap {
  background: rgba(217, 86, 79, 0.1);
  color: var(--expense);
}
.card-balance .card-icon-wrap {
  background: rgba(75, 98, 89, 0.15);
  color: var(--ink-soft);
}
.card-savings .card-icon-wrap {
  background: rgba(201, 151, 62, 0.12);
  color: var(--gold);
}

.card-info-wrap .card-lbl {
  font-size: 13px;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 2px;
}
.card-info-wrap .card-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

/* Main Splits Dashboard */
.sm-new-db-main-layout {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 24px;
}
.sm-new-db-block {
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 28px;
}
.sm-new-db-block .block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sm-new-db-block .block-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.sm-new-db-block .block-subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  display: block;
  margin-top: 2px;
}

/* Pure CSS Grid Analytics Chart */
.sm-new-db-chart-container {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 16px;
  height: 220px;
  margin-top: 32px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}
.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
  padding-bottom: 24px;
}
.chart-bars-area {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 100%;
}
.chart-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  height: 100%;
  justify-content: flex-end;
}
.bar-group {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: calc(100% - 24px);
  width: 100%;
  justify-content: center;
}
.bar {
  width: 20px;
  border-radius: 4px 4px 0 0;
  transition: opacity 0.2s;
  cursor: pointer;
}
.bar:hover {
  opacity: 0.8;
}
.bar-income {
  background-color: var(--primary);
}
.bar-expense {
  background-color: var(--expense);
}

.column-lbl {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
  height: 14px;
}
.chart-legends {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 24px;
  font-size: 13.5px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
}
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.income-dot {
  background-color: var(--primary);
}
.expense-dot {
  background-color: var(--expense);
}

/* History Transactions Component */
.view-all-link {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--primary);
}
.view-all-link:hover {
  text-decoration: underline;
}

.sm-new-db-tx-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.tx-item {
  display: flex;
  align-items: center;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  gap: 14px;
}
.tx-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-badge svg {
  width: 16px;
  height: 16px;
}
.badge-inc {
  background: rgba(31, 122, 92, 0.1);
  color: var(--primary);
}
.badge-exp {
  background: rgba(217, 86, 79, 0.1);
  color: var(--expense);
}

.tx-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.tx-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.tx-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.tx-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  text-align: right;
}
.income-text {
  color: var(--primary);
}
.expense-text {
  color: var(--expense);
}

/* Dashboard Media Responsive queries */
@media (max-width: 1024px) {
  .sm-new-db-cards-grid {
    /* grid-template-columns removed */
  }
  .sm-new-db-main-layout {
    /* grid-template-columns removed */
  }
}
@media (max-width: 680px) {
  .sm-new-db-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .sm-new-db-cards-grid {
    /* grid-template-columns removed */
  }
  .sm-new-db-container {
    padding: 30px 20px 60px;
  }
}

/* ==========================================================================
   Dashboard / Transactions pages
   ========================================================================== */

.card-surface {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(18, 36, 31, 0.08);
  border-radius: 28px;
  box-shadow: 0 18px 40px -28px rgba(18, 36, 31, 0.28);
  backdrop-filter: blur(12px);
}

.dashboard-page,
.transaction-page {
  padding: 48px 0 80px;
}

.dashboard-hero {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 28px;
  padding: 28px;
  align-items: center;
  margin-bottom: 22px;
}

.dashboard-hero h1,
.page-head h1 {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 12px;
}

.dashboard-hero .lead,
.page-head .lead {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.dashboard-profile-card {
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(
    160deg,
    rgba(31, 122, 92, 0.12),
    rgba(201, 151, 62, 0.08)
  );
  border: 1px solid rgba(31, 122, 92, 0.12);
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-preview {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(18, 36, 31, 0.08);
}
.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-preview span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--primary-dark);
}

.dashboard-profile-card h2 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 22px;
}
.dashboard-profile-card p {
  margin: 0 0 10px;
  color: var(--ink-soft);
}

.mini-link {
  color: var(--primary-dark);
  font-weight: 700;
}
.mini-link:hover {
  text-decoration: underline;
}

.summary-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 22px;
  border-radius: 24px;
  color: #fff;
}
.summary-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  margin: 8px 0 4px;
}
.summary-card small {
  opacity: 0.86;
}
.summary-label {
  font-size: 13px;
  opacity: 0.9;
}
.income-card {
  background: linear-gradient(160deg, #1f7a5c, #165b45);
}
.expense-card {
  background: linear-gradient(160deg, #d9564f, #ad3d38);
}
.balance-card {
  background: linear-gradient(160deg, #1f2730, #34414b);
}

.dashboard-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  margin-bottom: 18px;
}

.chart-card,
.quick-panel,
.recent-card,
.page-head,
.tx-form,
.tx-list-card {
  padding: 24px;
}

.section-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.section-headline h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
}
.section-headline p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.mini-chart {
  /* display: grid; removed */
  gap: 14px;
}
.mini-chart-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  align-items: center;
}
.mini-chart-label {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  font-size: 13px;
}
.mini-bars {
  display: flex; flex-direction: column; gap: 8px;
}
.mini-bar {
  height: 12px;
  border-radius: 999px;
}
.mini-bar.income {
  background: linear-gradient(90deg, #1f7a5c, rgba(31, 122, 92, 0.42));
}
.mini-bar.expense {
  background: linear-gradient(90deg, #d9564f, rgba(217, 86, 79, 0.42));
}

.quick-links {
  /* display: grid; removed */
  gap: 10px;
}
.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(31, 122, 92, 0.06);
  color: var(--primary-dark);
  font-weight: 600;
  border: 1px solid rgba(31, 122, 92, 0.1);
}
.quick-link:hover {
  background: rgba(31, 122, 92, 0.1);
}
.danger-link {
  background: rgba(217, 86, 79, 0.08);
  color: var(--expense);
  border-color: rgba(217, 86, 79, 0.14);
}

.transactions-stack {
  /* display: grid; removed */
  gap: 12px;
}
.transaction-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(242, 247, 245, 0.7);
  border: 1px solid rgba(18, 36, 31, 0.06);
}
.transaction-row-grid {
  /* grid-template-columns removed */
}
.tx-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  flex: 0 0 auto;
}
.tx-pill.is-income {
  background: var(--primary);
}
.tx-pill.is-expense {
  background: var(--expense);
}
.transaction-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.transaction-main strong {
  font-size: 15px;
}
.transaction-main span,
.transaction-main small {
  color: var(--ink-soft);
  font-size: 13px;
}
.transaction-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  padding: 20px;
  border-radius: 18px;
  background: rgba(31, 122, 92, 0.06);
  color: var(--ink-soft);
  text-align: center;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}
.page-summary {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  min-width: 280px;
}
.page-summary div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(31, 122, 92, 0.06);
}
.page-summary small {
  display: block;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.page-summary strong {
  font-family: var(--font-display);
  font-size: 22px;
}

.notice {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 600;
}
.success-notice {
  background: rgba(31, 122, 92, 0.1);
  color: var(--primary-dark);
}
.error-notice {
  background: rgba(217, 86, 79, 0.1);
  color: var(--expense);
}

.transaction-layout {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
}

.tx-form,
.tx-list-card {
  align-self: start;
}
.tx-form label {
  display: block;
  margin-bottom: 14px;
}
.tx-form span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
}
.tx-form input,
.tx-form select,
.tx-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
}
.tx-form input:focus,
.tx-form select:focus,
.tx-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 92, 0.12);
}
.two-cols {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
}

.compact-stack .transaction-row {
  align-items: start;
}
.tx-delete-form {
  align-self: center;
}
.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18, 36, 31, 0.06);
  color: var(--ink-soft);
}
.icon-button svg {
  width: 18px;
  height: 18px;
}
.icon-button:hover {
  background: rgba(217, 86, 79, 0.12);
  color: var(--expense);
}
.danger-icon {
  background: rgba(217, 86, 79, 0.08);
}

.history-filter-card {
  padding: 24px;
  margin-bottom: 18px;
}

.history-filter-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  align-items: end;
}

.history-filter-grid label {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0;
}

.history-filter-grid span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.history-filter-grid input,
.history-filter-grid select {
  width: 100%;
  border: 1px solid rgba(18, 36, 31, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 11px 13px;
  font: inherit;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.history-filter-grid input:focus,
.history-filter-grid select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 92, 0.12);
}

.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  grid-column: 1 / -1;
}

.history-stack {
  gap: 14px;
}

.history-transaction-card {
  align-items: start;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(242, 247, 245, 0.87)
  );
}

.history-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.history-attachment-card {
  max-width: 180px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(18, 36, 31, 0.08);
  background: rgba(31, 122, 92, 0.06);
}

.history-attachment-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.history-attachment-card a {
  display: block;
  padding: 10px;
  color: var(--primary-dark);
  font-size: 13px;
}

@media (max-width: 980px) {
  .dashboard-hero,
  .dashboard-grid,
  .transaction-layout,
  .page-head {
    /* grid-template-columns removed */
    /* display: grid; removed */
  }

  .summary-grid {
    /* grid-template-columns removed */
  }
  .history-filter-grid {
    /* grid-template-columns removed */
  }
}

@media (max-width: 640px) {
  .dashboard-page,
  .transaction-page {
    padding-top: 32px;
  }

  .dashboard-hero,
  .page-head,
  .chart-card,
  .quick-panel,
  .recent-card,
  .tx-form,
  .tx-list-card {
    padding: 18px;
  }

  .transaction-row,
  .transaction-row-grid {
    /* grid-template-columns removed */
  }

  .transaction-amount,
  .tx-delete-form {
    grid-column: 2;
  }

  .two-cols {
    /* grid-template-columns removed */
  }
  .page-summary {
    min-width: 0;
    /* grid-template-columns removed */
  }
}

/* ---------------- Dashboard simplified refresh ---------------- */

.dashboard-clean {
  padding-bottom: 84px;
}

.dashboard-hero-lite {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 20px;
  padding: 28px;
  border-radius: 32px;
  background:
    radial-gradient(
      circle at top right,
      rgba(15, 118, 110, 0.1),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.92),
      rgba(248, 250, 249, 0.88)
    );
  border: 1px solid rgba(16, 33, 29, 0.08);
  box-shadow: 0 26px 56px -34px rgba(16, 33, 29, 0.3);
}

.hero-copy-lite h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.04em;
}

.hero-copy-lite .lead {
  max-width: 620px;
  margin: 0 0 24px;
}

.hero-balance-card {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.hero-balance-card span,
.hero-mini-stats span,
.snapshot-card span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero-balance-card strong {
  display: block;
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 44px);
}

.balance-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(18, 36, 31, 0.08);
  overflow: hidden;
}

.balance-progress > div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), rgba(15, 118, 110, 0.5));
}

.balance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.hero-visual-card {
  /* display: grid; removed */
  gap: 18px;
  align-content: start;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9),
    rgba(240, 246, 244, 0.9)
  );
  border: 1px solid rgba(16, 33, 29, 0.08);
}

.hero-visual-ring {
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  padding: 18px;
  background:
    radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.95) 0 38%,
      transparent 39%
    ),
    conic-gradient(
      from 230deg,
      var(--primary) 0 52%,
      rgba(214, 162, 74, 0.82) 52% 74%,
      rgba(214, 93, 93, 0.62) 74% 100%
    );
  box-shadow: inset 0 0 0 1px rgba(16, 33, 29, 0.06);
}

.ring-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(244, 248, 246, 0.95)
  );
}

.ring-core span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.ring-core strong {
  display: block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 30px;
}

.hero-mini-stats {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 10px;
}

.hero-mini-stats > div,
.snapshot-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(16, 33, 29, 0.08);
}

.hero-mini-stats strong,
.snapshot-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 18px;
}

.dashboard-snapshot-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 14px;
  margin: 18px 0;
}

.snapshot-card {
  min-height: 132px;
}

.snapshot-income {
  background: linear-gradient(
    180deg,
    rgba(15, 118, 110, 0.1),
    rgba(255, 255, 255, 0.86)
  );
}

.snapshot-expense {
  background: linear-gradient(
    180deg,
    rgba(214, 93, 93, 0.1),
    rgba(255, 255, 255, 0.86)
  );
}

.snapshot-category {
  background: linear-gradient(
    180deg,
    rgba(214, 162, 74, 0.1),
    rgba(255, 255, 255, 0.86)
  );
}

.dashboard-main-grid-lite {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  align-items: start;
}

.lite-card {
  padding: 24px;
  border-radius: 28px;
}

.lite-headline {
  margin-bottom: 20px;
}

.mini-chart-lite {
  /* display: grid; removed */
  gap: 12px;
}

.mini-chart-row-lite {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  align-items: center;
}

.mini-bars-lite {
  display: flex; flex-direction: column; gap: 8px;
}

.mini-chart-caption {
  font-size: 13px;
  color: var(--ink-soft);
}

.transactions-stack-lite {
  /* display: grid; removed */
  gap: 10px;
}

.transaction-row-lite {
  padding: 12px 14px;
  border-radius: 18px;
}

.transaction-main-lite strong {
  font-size: 14px;
}

.quick-actions-lite {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.quick-actions-lite .quick-link {
  flex: 1 1 180px;
  justify-content: center;
}

@media (max-width: 1100px) {
  .dashboard-hero-lite,
  .dashboard-main-grid-lite,
  .dashboard-snapshot-grid {
    /* grid-template-columns removed */
  }

  .hero-mini-stats {
    /* grid-template-columns removed */
  }
}

@media (max-width: 640px) {
  .dashboard-hero-lite,
  .lite-card,
  .snapshot-card {
    padding: 18px;
  }

  .hero-copy-lite h1 {
    font-size: 28px;
  }

  .hero-visual-ring {
    width: min(100%, 240px);
  }

  .quick-actions-lite .quick-link {
    flex-basis: 100%;
  }
}

/* ---------------- Dashboard pro refresh ---------------- */

.dashboard-hub {
  padding-bottom: 84px;
}

.dashboard-hero--pro {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 20px;
  align-items: stretch;
  padding: 30px;
  border-radius: 32px;
  background:
    radial-gradient(
      circle at top right,
      rgba(15, 118, 110, 0.12),
      transparent 28%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(214, 162, 74, 0.12),
      transparent 24%
    ),
    rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(16, 33, 29, 0.08);
  box-shadow: 0 28px 60px -34px rgba(16, 33, 29, 0.34);
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.08;
  margin: 0 0 16px;
  letter-spacing: -0.04em;
}

.hero-copy .lead {
  max-width: 680px;
  margin-bottom: 24px;
}

.hero-meta-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  margin-top: 18px;
}

.hero-meta-item,
.signal-panel,
.kpi-card,
.focus-card {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(16, 33, 29, 0.08);
  box-shadow: var(--shadow-soft);
}

.hero-meta-item {
  padding: 16px 18px;
}

.hero-meta-item span,
.signal-list span,
.pulse-insight span,
.focus-list span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero-meta-item strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 22px;
}

.signal-panel {
  padding: 20px;
  /* display: grid; removed */
  gap: 16px;
  align-content: start;
  background: linear-gradient(
    180deg,
    rgba(15, 118, 110, 0.08),
    rgba(255, 255, 255, 0.84)
  );
}

.signal-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signal-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.signal-balance {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(15, 118, 110, 0.96),
    rgba(14, 76, 71, 0.96)
  );
  color: #fff;
}

.signal-balance strong {
  display: block;
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: -0.03em;
}

.signal-list {
  /* display: grid; removed */
  gap: 12px;
}

.signal-list > div,
.focus-list > div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(16, 33, 29, 0.08);
}

.signal-list strong,
.focus-list strong {
  display: block;
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
}

.dashboard-kpi-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 14px;
  margin: 18px 0;
}

.kpi-card {
  padding: 20px;
  min-height: 168px;
}

.kpi-card strong {
  display: block;
  margin: 8px 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.03em;
}

.kpi-card-primary {
  background: linear-gradient(
    180deg,
    rgba(15, 118, 110, 0.96),
    rgba(13, 89, 84, 0.96)
  );
  color: #fff;
}

.kpi-card-accent {
  background: linear-gradient(
    180deg,
    rgba(214, 162, 74, 0.2),
    rgba(255, 255, 255, 0.88)
  );
}

.kpi-card .kpi-foot {
  margin-top: 18px;
  font-size: 13px;
  color: inherit;
  opacity: 0.8;
}

.dashboard-main-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 18px;
  align-items: start;
}

.dashboard-side-stack {
  /* display: grid; removed */
  gap: 18px;
}

.pulse-card,
.pro-panel,
.focus-card,
.recent-card-pro {
  padding: 24px;
  border-radius: 28px;
}

.mini-chart-pro {
  gap: 16px;
}

.mini-chart-row-pro {
  /* grid-template-columns removed */
}

.mini-bars-track {
  display: flex; flex-direction: column; gap: 8px;
}

.mini-chart-caption {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}

.mini-chart-caption strong {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 15px;
}

.pulse-insight-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 12px;
  margin-top: 18px;
}

.pulse-insight {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 33, 29, 0.08);
}

.pulse-insight strong {
  display: block;
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
}

.quick-links-pro {
  gap: 10px;
}

.quick-links-pro .quick-link {
  background: rgba(255, 255, 255, 0.82);
}

.focus-list {
  /* display: grid; removed */
  gap: 12px;
}

.transaction-row-pro {
  /* grid-template-columns removed */
  padding: 16px 18px;
  border-radius: 22px;
}

.transaction-main-pro small {
  margin-top: 4px;
}

.recent-card-pro {
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .dashboard-hero--pro,
  .dashboard-main-grid,
  .dashboard-kpi-grid {
    /* grid-template-columns removed */
  }

  .hero-meta-row {
    /* grid-template-columns removed */
  }
}

@media (max-width: 640px) {
  .dashboard-hero--pro,
  .pulse-card,
  .pro-panel,
  .focus-card,
  .recent-card-pro,
  .kpi-card {
    padding: 18px;
  }

  .hero-copy h1 {
    font-size: 30px;
  }

  .signal-balance strong {
    font-size: 28px;
  }

  .pulse-insight-grid {
    /* grid-template-columns removed */
  }

  .transaction-row-pro {
    /* grid-template-columns removed */
  }

  .transaction-row-pro .transaction-amount {
    grid-column: 2;
    justify-self: start;
  }
}

/* สไตล์ฟุตเตอร์หลัก */
.site-footer {
  background-color: #1a2521; /* ปรับสีเขียวเข้มให้ดูแพงและมีน้ำหนัก */
  color: rgba(255, 255, 255, 0.7);
  padding: 30px 0 0 0; /* 1. แก้ตรงนี้: จากเดิม 60px ลดเหลือ 30px */
  font-size: 13.5px; /* 2. แก้ตรงนี้: จากเดิม 14px ปรับฟอนต์ให้เล็กกระชับลง */
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ระบบ Grid สำหรับ 4 คอลัมน์ */
.footer-grid {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 24px; /* 3. แก้ตรงนี้: จากเดิม 40px ลดระยะห่างระหว่างคอลัมน์ */
  padding-bottom: 24px; /* 4. แก้ตรงนี้: จากเดิม 40px ลดช่องว่างด้านล่างลง */
}

/* จัดการแต่ละคอลัมน์ */
.footer-col h5 {
  color: #fff;
  font-size: 15px; /* 5. แก้ตรงนี้: จากเดิม 16px */
  margin-bottom: 12px; /* 6. แก้ตรงนี้: จากเดิม 20px ให้หัวข้อชิดเนื้อหามากขึ้น */
  font-weight: 600;
}

.brand-tagline {
  font-size: 13px;
  line-height: 1.5; /* 7. แก้ตรงนี้: จากเดิม 1.6 */
  margin-bottom: 12px; /* 8. แก้ตรงนี้: จากเดิม 20px */
  color: rgba(255, 255, 255, 0.5);
}

/* จัดการชุดลิงก์ */
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px; /* 9. แก้ตรงนี้: จากเดิม 12px ให้บรรทัดลิงก์ชิดกันมากขึ้น */
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #5cdba7; /* สีเขียวสว่างเวลาชี้ */
}

/* ปุ่มโซเชียล */
.footer-socials {
  display: flex;
  gap: 12px;
}

.footer-socials a {
  color: rgba(255, 255, 255, 0.4);
  transition:
    color 0.2s,
    transform 0.2s;
}

.footer-socials a:hover {
  color: #fff;
  transform: translateY(-2px);
}

/* จุดสถานะระบบ (System Status Dot) */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #2ec4b6;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 8px #2ec4b6;
}

/* แถบลิขสิทธิ์ล่างสุด */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 0; /* 10. แก้ตรงนี้: จากเดิม 20px ขยับแถบล่างสุดให้ผอมลง */
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* รองรับหน้าจอมือถือ */
@media (max-width: 768px) {
  .footer-grid {
    /* grid-template-columns removed */
    gap: 30px;
  }

  .footer-bottom-inner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

/* ลบ padding ของ body เฉพาะหน้าที่มีโครงสร้าง auth-page */
body:has(.auth-page) {
  padding-top: 0 !important;
}

/* ปรับให้หน้าล็อกอินสูงเต็มจอแบบ 100% */
.auth-page {
  min-height: 100vh !important;
}

.history-page {
  position: relative;
  margin-bottom: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.history-page .filter-bar {
  padding: 1.25rem;
  background: var(--paper, #fbf7ec);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.history-page .filter-section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-page .filter-grid-main {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.history-page .filter-grid-row-double {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.history-page .filter-sub-group {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 0.75rem;
}

@media (max-width: 991px) {
  .history-page .filter-grid-main {
    /* grid-template-columns removed */
  }

  .history-page .filter-grid-row-double {
    /* grid-template-columns removed */
  }
}

.history-page .filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.history-page .filter-bar label span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

.history-page .filter-bar input,
.history-page .filter-bar select {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  background: #fff;
  color: var(--ink);
  width: 100%;
  height: 38px;
  font-family: var(--font-body);
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.history-page .filter-bar input:focus,
.history-page .filter-bar select:focus {
  border-color: var(--primary);
  outline: none;
}

.history-page .filter-actions {
  display: flex;
  gap: 0.5rem;
  height: 38px;
  margin-top: 0.25rem;
  justify-content: flex-end;
}

.history-page .filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: var(--font-display);
  height: 38px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.85rem;
}

.history-page .history-card {
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.history-page .history-card .section-headline {
  margin-bottom: 1rem;
}

.history-page .income-text {
  color: var(--primary) !important;
}

.history-page .expense-text {
  color: var(--expense) !important;
}

.history-page .amt-swap {
  display: inline-block;
  position: relative;
}

.history-page .amt-swap .amt-full {
  display: none;
}

.history-page .transaction-row-grid {
  transition: all 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
}

.history-page .transaction-row-grid:hover {
  transform: scale(1.005);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 20px -8px rgba(18, 36, 31, 0.05);
  border-left: 4px solid var(--ink-soft);
}

.history-page .transaction-row-grid:hover .tx-pill.is-income {
  background: var(--primary);
  color: #fff;
  transition: all 0.4s ease;
}

.history-page .transaction-row-grid:hover .tx-pill.is-expense {
  background: var(--expense);
  color: #fff;
  transition: all 0.4s ease;
}

.history-page .transaction-row-grid:hover .amt-swap .amt-short {
  display: none;
}

.history-page .transaction-row-grid:hover .amt-swap .amt-full {
  display: inline;
  animation: softFadeInAmt 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.history-page .empty-history {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-soft);
}

.history-page .empty-history svg {
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
  opacity: 0.3;
}

@keyframes softFadeInAmt {
  from {
    opacity: 0;
    transform: translateX(6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   [รวมกลาง] Shared Components — สกัดจาก inline <style> ของทุกหน้า
   ========================================================================== */

/* --- Keyframes --- */
@keyframes spin {
  100% { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* --- Summary Cards (dashboard / transactions / history) --- */
.summary-wrapper {
  position: relative;
  height: 100px;
}
.summary-card {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  z-index: 1;
  box-sizing: border-box;
  cursor: pointer;
  min-height: 100%;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.summary-card:hover {
  width: max-content;
  min-width: 100%;
  right: auto;
  background-color: #ffffff !important;
  border-color: rgba(18,36,31,0.15) !important;
  box-shadow: 0 12px 28px rgba(18,36,31,0.12);
  z-index: 10;
  transform: translateY(-4px);
}
.summary-card small {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
  display: block;
}
.amount-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

/* ซ่อน/แสดงค่าย่อ-เต็ม */
.amount-value .short-val { display: inline; }
.amount-value .full-val  { display: none; }
.summary-card:hover .amount-value .short-val { display: none !important; }
.summary-card:hover .amount-value .full-val  { display: inline !important; }

/* Card Income */
.summary-card.card-income { background: #f4f9f7 !important; border-color: #e8f5e9 !important; }
.card-income small        { color: #2e7d32 !important; }
.card-income .amount-value { color: #1a5c40 !important; }

/* Card Expense */
.summary-card.card-expense { background: #fff1f0 !important; border-color: #ffcdd2 !important; }
.card-expense small         { color: #d9564f !important; }
.card-expense .amount-value { color: #c54841 !important; }

/* Card Balance */
.summary-card.card-balance { background: #f8fbf9 !important; border-color: #e2e8e5 !important; }
.card-balance small                         { color: #5A7167 !important; }
.card-balance .amount-value                 { color: #12241F !important; }
.card-balance .amount-value.income-text     { color: #1a5c40 !important; }
.card-balance .amount-value.expense-text    { color: #c54841 !important; }

/* สี helper ทั่วไป */
.income-text  { color: #1a5c40 !important; }
.expense-text { color: #c54841 !important; }

/* --- Tx Amount Hover --- */
.tx-amount-hover-container {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 120px;
  text-align: right;
  cursor: pointer;
}
.tx-amount-inner .short-tx-val { display: inline; }
.tx-amount-inner .full-tx-val  { display: none; }
.transaction-row-grid:hover .tx-amount-inner .short-tx-val { display: none !important; }
.transaction-row-grid:hover .tx-amount-inner .full-tx-val  { display: inline !important; font-weight: 700; white-space: nowrap; }

/* backward-compat: dashboard uses different class names */
.tx-amount-inner-card .full-tx-val { display: none; }
.transaction-row-grid:hover .tx-amount-inner-card .short-tx-val { display: none; }
.transaction-row-grid:hover .tx-amount-inner-card .full-tx-val  { display: inline; font-weight: 700; white-space: nowrap; }

/* --- Danger Icon Button --- */
.icon-button.danger-icon {
  background: none; border: none; cursor: pointer;
  padding: 6px; color: #999;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all 0.2s;
}
.icon-button.danger-icon:hover  { background: #FFF1F0; color: #D9564F; transform: scale(1.1); }
.icon-button.danger-icon svg    { width: 20px; height: 20px; }

/* Clickable row */
.clickable-row { cursor: pointer; transition: background-color 0.2s ease; }
.clickable-row:hover { background-color: rgba(0,0,0,0.03); }

/* --- SweetAlert2 Custom Theme (docmoney) --- */
.swal2-container.swal2-backdrop-show {
  backdrop-filter: blur(8px) !important;
  background: rgba(18,36,31,0.45) !important;
}
.swal-docmoney-popup {
  border-radius: 24px !important;
  background: #ffffff !important;
  padding: 2.5rem 2rem 2rem !important;
  font-family: inherit !important;
}
.custom-swal-icon-wrapper {
  width: 80px; height: 80px;
  background: #FFF1F0; border-radius: 50%;
  display: flex !important; align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 1.5rem auto !important;
  color: #D9564F;
}
.swal-docmoney-title  { font-size: 1.35rem !important; color: #12241F !important; font-weight: 700 !important; text-align: center !important; }
.swal-docmoney-text   { color: #5A7167 !important; font-size: 0.95rem !important; text-align: center !important; }
.swal-docmoney-actions { gap: 12px !important; margin-top: 2rem !important; width: 100% !important; display: flex !important; justify-content: center !important; }
.swal-docmoney-btn    { border-radius: 12px !important; font-weight: 600 !important; padding: 12px 24px !important; font-size: 0.95rem; flex: 1 !important; cursor: pointer; border: none !important; }
.swal-docmoney-confirm         { background-color: #D9564F !important; color: white !important; }
.swal-docmoney-cancel          { background-color: #f1f4f3 !important; color: #12241F !important; }
.swal-docmoney-confirm-primary { background-color: #1a5c40 !important; color: white !important; }
.swal-docmoney-confirm-primary:hover { background-color: #12402c !important; }

/* SweetAlert สำหรับ footer (contact/privacy) */
.swal-docmoney-popup-contact {
  border-radius: 24px !important;
  box-shadow: 0 24px 48px rgba(0,0,0,0.12) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  background: #ffffff !important;
  padding: 2.5rem 2rem 2rem !important;
  font-family: inherit !important;
  max-width: 520px !important;
}
.swal-docmoney-title-contact {
  font-size: 1.35rem !important; color: #12241F !important;
  font-weight: 700 !important; margin: 0 0 0.5rem 0 !important;
  line-height: 1.4 !important; text-align: center !important;
}
.swal-docmoney-btn-contact {
  background-color: #1a5c40 !important; color: white !important;
  border-radius: 12px !important; font-weight: 600 !important;
  padding: 12px 24px !important; font-size: 0.95rem !important;
  transition: all 0.2s ease-in-out !important; border: none !important;
  outline: none !important; margin-top: 1.5rem !important; cursor: pointer;
}
.swal-docmoney-btn-contact:hover {
  background-color: #12402c !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26,92,64,0.25) !important;
}
.swal-docmoney-scroll::-webkit-scrollbar       { width: 6px; }
.swal-docmoney-scroll::-webkit-scrollbar-track { background: #f1f4f3; border-radius: 4px; }
.swal-docmoney-scroll::-webkit-scrollbar-thumb { background: #c3d0cb; border-radius: 4px; }
.swal-docmoney-scroll::-webkit-scrollbar-thumb:hover { background: #a5b8b0; }

/* --- Edit Modal Attachments --- */
.edit-modal-attachments { background: #f8f9fa; border-radius: 8px; padding: 12px; margin-bottom: 16px; border: 1px solid #e9ecef; }
.edit-modal-attachments ul { list-style: none; padding: 0; margin: 8px 0 0 0; }
.edit-modal-attachments li { margin-bottom: 6px; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; }
.edit-modal-attachments .file-link { display: flex; align-items: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-modal-attachments .file-link::before { content: "📎"; margin-right: 6px; font-size: 0.8rem; }
.edit-modal-attachments a { color: #1a5c40; text-decoration: none; font-weight: 500; }
.edit-modal-attachments a:hover { text-decoration: underline; }
.remove-file-btn {
  background: #ffebeb; color: #d9564f; border: none; cursor: pointer;
  font-size: 0.75rem; font-weight: bold; padding: 4px 8px;
  border-radius: 4px; transition: all 0.2s ease; margin-left: 10px;
}
.remove-file-btn:hover { background: #d9564f; color: #fff; }

/* --- Styled Form Card (transactions / history edit modal) --- */
.styled-form-card { background: #ffffff; border-radius: 16px; padding: 24px; box-shadow: 0 8px 30px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.05); margin-bottom: 24px; }
.styled-form-card h2 { font-size: 1.25rem; color: #12241F; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f0f0f0; padding-bottom: 16px; }
.styled-form-card label { display: block; margin-bottom: 18px; text-align: left; }
.styled-form-card label > span { display: block; font-size: 0.85rem; font-weight: 600; color: #5A7167; margin-bottom: 8px; }
.styled-form-card input,
.styled-form-card select,
.styled-form-card textarea {
  width: 100%; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 8px;
  font-family: inherit; font-size: 0.95rem; background-color: #fafafa;
  transition: all 0.2s ease; box-sizing: border-box; color: #333; outline: none;
}
.styled-form-card input:focus,
.styled-form-card select:focus,
.styled-form-card textarea:focus { border-color: #4A9E7A; background-color: #ffffff; box-shadow: 0 0 0 4px rgba(74,158,122,0.1); }
.styled-form-card .two-cols { /* display: grid; removed */ /* grid-template-columns removed */ gap: 16px; }

/* File Upload Wrapper */
.file-input-wrapper {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 2px dashed #dcdcdc; border-radius: 8px;
  padding: 24px 16px; background-color: #fafafa;
  cursor: pointer; text-align: center;
}
.file-input-wrapper:hover { border-color: #4A9E7A; background-color: #f4f9f7; }
.file-input-wrapper input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }

/* --- Filter Card Wrapper --- */
.filter-card-wrapper { background: #ffffff; border-radius: 18px; padding: 24px; border: 1px solid rgba(18,36,31,0.06); box-shadow: 0 10px 25px rgba(18,36,31,0.02); margin-bottom: 24px; }
.filter-header-flex { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; border-bottom: 1px solid #f0f0f0; padding-bottom: 16px; flex-wrap: wrap; }
.filter-header-title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; color: #12241F; }
.filter-header-title svg { color: #4A9E7A; background: #EAF2EE; padding: 6px; border-radius: 10px; width: 20px; height: 20px; }
.filter-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* Shared Button Styles */
.btn-submit-primary {
  background: linear-gradient(135deg, #1a5c40, #4A9E7A); color: #fff;
  padding: 10px 24px; border: none; border-radius: 10px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 12px rgba(26,92,64,0.15); transition: all 0.2s ease;
}
.btn-submit-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(26,92,64,0.25); }
.btn-cancel-light {
  background: #FFF1F0; color: #D9564F; padding: 10px 24px;
  border: 1px solid #FFCDD2; border-radius: 10px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}

/* --- Transactions Layout (transactions.php) --- */
.transactions-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 24px; }
.form-section    { flex: 1.2; min-width: 320px; position: sticky; top: 24px; }
.history-section { flex: 1.4; min-width: 320px; }

/* Category toggle button */
.btn-category-toggle { background: #f4f9f7; border: 1px solid #4A9E7A; color: #1a5c40; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-category-toggle:hover { background: #4A9E7A; color: #ffffff; }
.btn-category-toggle.cancel-mode { background: #fff1f0; border-color: #d9564f; color: #d9564f; }

/* Month badge + selector */
.selected-months-container { display: flex; flex-wrap: wrap; gap: 8px; }
.month-badge { background: #EAF2EE; color: #1A5C40; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; border: 1px solid #CDE2D8; }
.btn-search-month { background: #ffffff; border: 1.5px solid #4A9E7A; color: #4A9E7A; padding: 8px 16px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 6px; }
.btn-search-month:hover { background: #4A9E7A; color: #ffffff; }

/* Month selector modal (SweetAlert) */
.swal-month-grid { /* display: grid; removed */ /* grid-template-columns removed */ gap: 8px; margin-top: 15px; }
.month-cb-item input[type="checkbox"] { display: none; }
.month-cb-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; background-color: #FCFDFD; border: 1.5px solid #E2E8E5; border-radius: 12px; cursor: pointer; transition: all 0.2s; user-select: none; font-size: 0.88rem; font-weight: 600; color: #5A7167; text-align: center; }
.month-cb-label:hover { border-color: #4A9E7A; background-color: #F7FAF9; }
.cb-tick-circle { width: 16px; height: 16px; border: 2px solid #CDE2D8; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s; background: #fff; }
.month-cb-item input[type="checkbox"]:checked + .month-cb-label { background-color: #EAF2EE; border-color: #4A9E7A; color: #1A5C40; }
.month-cb-item input[type="checkbox"]:checked + .month-cb-label .cb-tick-circle { background-color: #4A9E7A; border-color: #4A9E7A; }
.month-cb-item input[type="checkbox"]:checked + .month-cb-label .cb-tick-circle::after { content: ""; width: 4px; height: 7px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); display: block; margin-bottom: 2px; }
.swal-custom-select { padding: 10px 14px; border: 1.5px solid #E2E8E5; border-radius: 10px; font-size: 0.95rem; color: #12241F; font-weight: 600; outline: none; cursor: pointer; background-color: #f8fbf9; margin-bottom: 5px; }
.swal-custom-select:focus { border-color: #4A9E7A; background-color: #fff; }

/* --- History Filter (history.php) --- */
.history-filter-grid { /* display: grid; removed */ /* grid-template-columns removed */ gap: 16px; margin-bottom: 16px; }
.history-filter-grid label > span { display: block; font-size: 0.85rem; font-weight: 600; color: #5A7167; margin-bottom: 8px; }
.history-filter-grid input,
.history-filter-grid select { width: 100%; padding: 10px 14px; border: 1.5px solid #E2E8E5; border-radius: 10px; font-size: 0.95rem; background-color: #FCFDFD; transition: all 0.2s ease; outline: none; }
.history-filter-grid input:focus,
.history-filter-grid select:focus { border-color: #4A9E7A; box-shadow: 0 0 0 4px rgba(74,158,122,0.1); }

/* Tab Navigation (history.php) */
.tax-tabs { display: flex; border-bottom: 2px solid #E2E8E5; margin-bottom: 24px; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.tax-tab-btn { background: transparent; border: none; padding: 12px 24px; font-size: 0.95rem; font-weight: 600; color: #5A7167; cursor: pointer; transition: all 0.2s; border-radius: 12px 12px 0 0; position: relative; white-space: nowrap; }
.tax-tab-btn:hover { color: #1a5c40; background: #F7FAF9; }
.tax-tab-btn.active { color: #1a5c40; background: #E5EEE9; }
.tax-tab-btn.active::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 3px; background: #4A9E7A; border-radius: 3px 3px 0 0; }
.tax-content { display: none; }
.tax-content.active { display: block; animation: fadeIn 0.25s ease-in-out; }

/* --- Dashboard Specific --- */
.dashboard-grid-layout {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 24px;
  margin-bottom: 24px;
}
.chart-container-row {
  /* display: grid; removed */
  /* grid-template-columns removed */
  gap: 24px;
  margin-bottom: 24px;
}
.chart-box {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.05);
  border-radius: 16px; padding: 24px;
  box-sizing: border-box; box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.chart-title {
  font-size: 1.05rem; font-weight: 700; color: #12241F;
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}
.balance-card {
  background: linear-gradient(135deg, #1a5c40, #12241F);
  color: #ffffff; border-radius: 16px; padding: 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(26,92,64,0.15);
}
.balance-card::after {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 250px; height: 250px; background: rgba(255,255,255,0.03);
  border-radius: 50%; pointer-events: none;
}
.tax-widget-card {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.05);
  border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.02); height: 100%; box-sizing: border-box;
}
.tax-widget-header { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; color: #12241F; margin-bottom: 20px; }
.tax-widget-header svg { width: 24px; height: 24px; color: #2D9CDB; }
.tax-widget-grid { /* display: grid; removed */ /* grid-template-columns removed */ gap: 16px; }
.tax-box { background: #f8f9fa; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; border: 1px solid #edf2f7; }
.tax-box.highlight { background: #F0F8FF; border-color: #BEE3F8; }
.tax-label { font-size: 0.85rem; color: #5A7167; font-weight: 600; margin-bottom: 6px; }
.tax-val { font-size: 1.6rem; font-weight: 700; color: #12241F; }
.tax-box.highlight .tax-label { color: #2B6CB0; }
.tax-box.highlight .tax-val   { color: #2C5282; }

/* Custom Date Picker */
.custom-date-container { position: relative; display: block; width: 100%; }
.custom-date-container input[type="date"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.custom-date-facade { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fafafa; transition: all 0.25s ease; box-sizing: border-box; cursor: pointer; }
.custom-date-container input[type="date"]:hover + .custom-date-facade { border-color: #4A9E7A; background-color: #f4f9f7; }
.custom-date-container input[type="date"]:focus + .custom-date-facade { border-color: #4A9E7A; background-color: #ffffff; box-shadow: 0 0 0 4px rgba(74,158,122,0.1); }
.custom-date-value { font-size: 0.95rem; font-weight: 600; color: #333; letter-spacing: 0.3px; }
.custom-date-icon { display: flex; align-items: center; justify-content: center; color: #4A9E7A; background-color: #eaf2ee; border-radius: 8px; padding: 6px; width: 18px; height: 18px; transition: all 0.2s; }
.custom-date-container input[type="date"]:hover + .custom-date-facade .custom-date-icon { transform: scale(1.05); background-color: #4A9E7A; color: #ffffff; }

/* Header Topbar Responsive Dropdown (from header.php) */
@media (max-width: 767.98px) {
  .topbar .navbar-collapse {
    position: absolute; top: 100%; left: 0; width: 100%;
    background-color: #2c3e50; z-index: 9999; padding: 15px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
  }
  .topbar .navbar-nav .nav-link { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
  .topbar .navbar-nav .nav-item:last-child .nav-link { border-bottom: none; }
}

/* ==========================================================================
   Responsive — เพิ่มเติมสำหรับ transactions / history layout
   ========================================================================== */

/* iPad / Tablet */
@media (max-width: 992px) {
  .transactions-layout { flex-direction: column; }
  .form-section { position: static; }
  .chart-container-row { /* grid-template-columns removed */ }
  .tax-widget-grid { /* grid-template-columns removed */ }
}

/* Mobile */
@media (max-width: 768px) {
  .swal-month-grid { /* grid-template-columns removed */ }
  .history-filter-grid { /* grid-template-columns removed */ }
  .styled-form-card .two-cols { /* grid-template-columns removed */ }
  .dashboard-grid-layout { /* grid-template-columns removed */ }
  .chart-container-row { /* grid-template-columns removed */ }
}

/* Small Mobile */
@media (max-width: 480px) {
  .swal-month-grid { /* grid-template-columns removed */ }
  .tax-widget-grid { /* grid-template-columns removed */ }
  .filter-card-wrapper { padding: 16px; }
  .tax-tab-btn { padding: 10px 14px; font-size: 0.85rem; }
}
