/* สไตล์ของ: การ์ดทักทาย, มาตรวัดวันนี้, เงินออม/เป้าหมาย, หน้าเลือกอวาตาร์
   โทนพาสเทลนุ่ม บนพื้นขาว — โหลดหลัง theme.css */

:root {
  --saving: #6b5bd6;
  --saving-soft: #efecfd;
  --cocoa: #3d2b20;
  --pastel-mint: #e6f6ef;
  --pastel-peach: #fdeee4;
  --pastel-lav: #f0edfc;
  --pastel-sky: #e8f1fc;
  --pastel-butter: #fdf5dc;
}

.saving {
  color: var(--saving);
}

.entry-amt.saving {
  color: var(--saving);
}

.cat-ico.saving-ico {
  background: var(--saving-soft);
}

/* ---------- การ์ดทักทาย ---------- */

.hello {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 22px;
  background:
    radial-gradient(60% 90% at 100% 100%, var(--hc, #e8f1fc), transparent 70%),
    radial-gradient(50% 80% at 0% 0%, #fdf5dc, transparent 70%),
    linear-gradient(135deg, #fffdf8, #ffffff);
  border: 1px solid #f1ede6;
}

.hello-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hello-greet {
  color: var(--text-2);
  font-size: 0.95rem;
}

.hello-text > b {
  font-size: 1.6rem;
  line-height: 1.25;
  color: var(--cocoa);
}

.hello-tip {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-top: 4px;
}

.hello-style {
  align-self: flex-start;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ht, var(--text-2));
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(60, 40, 20, 0.06);
}

.hello-av {
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.2s;
}

.hello-av:hover {
  transform: scale(1.05) rotate(-3deg);
}

.av-svg {
  display: block;
}

.me-btn {
  border: 0;
  padding: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent, #dde3ee);
  margin-left: 8px;
  flex: none;
}

.me-btn .av-svg {
  width: 38px;
  height: 38px;
}

/* ---------- การ์ดตัวเลขโทนพาสเทล ---------- */

.quick-row .mini {
  border: 0;
  box-shadow: none;
}

.quick-row .mini:nth-child(1) {
  background: var(--pastel-mint);
}

.quick-row .mini:nth-child(2) {
  background: var(--pastel-peach);
}

.quick-row .mini:nth-child(3) {
  background: var(--pastel-lav);
}

.mini-link {
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}

.mini-link:hover {
  transform: translateY(-2px);
}

.mini-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  margin: 6px 0 2px;
  overflow: hidden;
}

.mini-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a597f2, var(--saving));
}

/* ---------- มาตรวัดวันนี้ (เกจครึ่งวงกลม) ---------- */

.today-card {
  background: #fffdf9;
  border-color: transparent;
}

.today-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.today-head b {
  font-size: 1.05rem;
}

.today-head .link-btn {
  margin-left: auto;
}

.today-mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 6px;
}

.today-face .mood-face {
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 6px 12px rgba(60, 40, 20, 0.15));
  animation: face-pop 0.5s ease;
}

@keyframes face-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}

.today-feel {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 6px;
}

.today-sub {
  color: var(--text-2);
  font-size: 0.9rem;
}

.gauge-wrap {
  max-width: 320px;
  margin: 10px auto 0;
}

.gauge {
  display: block;
  width: 100%;
  height: auto;
}

.gauge-needle {
  animation: needle-in 0.8s cubic-bezier(0.3, 1.4, 0.5, 1);
}

@keyframes needle-in {
  from {
    transform: rotate(-60deg);
  }
}

.today-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 10px;
  color: var(--text-2);
  font-size: 0.92rem;
}

.mood-face {
  display: block;
}

.day-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.day-mood .mood-face {
  width: 20px;
  height: 20px;
}

/* ---------- ฟอร์ม: 3 ตัวเลือกในแถบเลือก ---------- */

.seg {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.seg-sm span {
  padding: 5px;
  font-size: 0.9rem;
}

#f-goal-field .chips {
  margin-top: 8px;
}

.no-goal {
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.amount-wrap.sm input {
  font-size: 1.25rem;
}

.field input[type="month"],
.field input[type="number"]:not(.amount-wrap input) {
  font: inherit;
  width: 100%;
  border: 1px solid rgba(120, 135, 175, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.field select {
  font: inherit;
  border: 1px solid rgba(120, 135, 175, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

/* ---------- หน้าเงินออม ---------- */

.section-head.sub {
  margin: 22px 0 12px;
}

.section-head.sub h3 {
  font-size: 1.1rem;
}

.save-card .progress-fill.save {
  background: linear-gradient(90deg, #a597f2, var(--saving));
}

.bc-pct.save b {
  color: var(--saving);
}

.pill.saving-pill {
  background: var(--saving-soft);
  color: var(--saving);
}

.pill.saving-pill b {
  background: transparent;
  width: auto;
  font-size: 0.85rem;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.goal-grid .card {
  margin: 0;
}

.goal-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.goal-card:hover,
.goal-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(40, 60, 140, 0.1);
  outline: none;
}

.goal-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goal-ico {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-style: normal;
}

.goal-ico.kind-shopping {
  background: var(--pastel-peach);
}
.goal-ico.kind-trip {
  background: var(--pastel-sky);
}
.goal-ico.kind-retire {
  background: var(--pastel-mint);
}
.goal-ico.kind-emergency {
  background: var(--pastel-butter);
}
.goal-ico.kind-other {
  background: var(--pastel-lav);
}

.goal-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.goal-title b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-title span {
  font-size: 0.8rem;
  color: var(--muted);
}

.goal-pct {
  font-weight: 800;
  color: var(--saving);
  font-size: 1.05rem;
}

.goal-amt b {
  font-size: 1.3rem;
}

.goal-bar {
  height: 8px;
  margin: 0;
  background: #f0eef8;
}

.goal-bar .progress-fill {
  background: linear-gradient(90deg, #a597f2, var(--saving));
}

.goal-card.done .goal-bar .progress-fill {
  background: linear-gradient(90deg, #9fd39f, #4a9e4a);
}

.goal-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.86rem;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.goal-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 180px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border: 2px dashed #dcd7f3 !important;
  background: #fcfbff !important;
  box-shadow: none !important;
}

.goal-new span {
  font-size: 1.8rem;
  color: var(--saving);
}

.goal-new:hover {
  background: var(--saving-soft) !important;
}

.kind-start {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.kind-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kind-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(40, 60, 140, 0.08);
}

.kind-tile .goal-ico {
  margin-bottom: 4px;
}

.kind-tile span:last-child {
  font-size: 0.82rem;
  color: var(--muted);
}

/* หน้าต่างสร้างเป้าหมาย: เลือกประเภท */
.kind-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.kind-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kind-opt span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  text-align: center;
  cursor: pointer;
  line-height: 1.25;
}

.kind-opt .goal-ico {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  border-radius: 12px;
}

.kind-opt input:checked + span {
  border-color: var(--saving);
  background: var(--saving-soft);
  color: var(--saving);
  font-weight: 700;
}

.kind-opt input:focus-visible + span {
  outline: 2px solid var(--saving);
  outline-offset: 2px;
}

.g-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goal-hint {
  background: var(--saving-soft);
  color: #3f3496;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

/* รายละเอียดเป้าหมาย */
.gd {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gd-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gd-title h2 {
  font-size: 1.15rem;
}

.gd-amount {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.gd-amount b {
  font-size: 1.7rem;
}

.gd-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gd-h {
  font-size: 1rem;
  margin-top: 6px;
}

.gd-hist {
  max-height: 260px;
  overflow-y: auto;
}

/* ---------- หน้าเลือกอวาตาร์ ---------- */

.avatar-screen {
  border: 0;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border-radius: 28px;
  background:
    radial-gradient(40% 30% at 0% 0%, #fde3d2, transparent 70%),
    radial-gradient(40% 30% at 100% 0%, #deebfb, transparent 70%),
    radial-gradient(45% 30% at 100% 100%, #fdf0d0, transparent 70%),
    radial-gradient(45% 30% at 0% 100%, #dbf3e9, transparent 70%),
    #fffdf9;
  box-shadow: 0 24px 70px rgba(40, 30, 20, 0.25);
}

.avatar-screen::backdrop {
  background: rgba(250, 247, 242, 0.92);
}

.avatar-screen form {
  padding: 28px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.av-head h2 {
  font-size: 1.7rem;
  color: var(--cocoa);
}

.av-head p {
  margin: 4px 0 0;
}

.av-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.av-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 14px 10px 12px;
  border-radius: 22px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.av-opt:hover {
  transform: translateY(-2px);
}

.av-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.av-opt:has(input:checked) {
  border-color: var(--c);
  background: #fff;
  box-shadow: 0 8px 22px rgba(40, 30, 20, 0.08);
}

.av-opt:has(input:focus-visible) {
  outline: 2px solid var(--c);
  outline-offset: 2px;
}

.av-circle {
  width: 120px;
  height: 120px;
  transition: transform 0.25s;
}

.av-circle .av-svg {
  width: 100%;
  height: 100%;
}

.av-opt:has(input:checked) .av-circle {
  transform: scale(1.06);
}

.av-opt b {
  color: var(--c);
  font-size: 1.05rem;
  margin-top: 6px;
}

.av-opt small {
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.35;
}

.av-name input {
  border: 1px solid #ebe5dc;
  border-radius: 14px;
  padding: 11px 14px;
  background: #fff;
}

.av-actions {
  display: flex;
  gap: 10px;
}

.av-go {
  flex: 1;
  padding: 13px 18px !important;
  background: #2a5d58 !important;
  border-color: #2a5d58 !important;
  box-shadow: 0 8px 20px rgba(42, 93, 88, 0.28) !important;
  font-size: 1.02rem;
}

.av-go:hover {
  background: #214c48 !important;
}

.tabs button {
  white-space: nowrap;
}

/* จอขนาดกลาง: ซ่อนชื่อแอพ ให้แท็บ 4 อันพอดีบรรทัดเดียว */
@media (min-width: 721px) and (max-width: 1000px) {
  .brand-name {
    display: none;
  }
}

/* ---------- มือถือ ---------- */

@media (max-width: 720px) {
  .hello .av-svg {
    width: 72px;
    height: 72px;
  }

  .hello-text > b {
    font-size: 1.35rem;
  }

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

  .av-circle {
    width: 92px;
    height: 92px;
  }

  .avatar-screen form {
    padding: 22px 16px 18px;
    gap: 14px;
  }

  .av-head h2 {
    font-size: 1.4rem;
  }

  .me-btn {
    margin-left: auto;
  }

  .menu-wrap {
    margin-left: 4px;
  }

  .goal-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gauge-needle,
  .today-face .mood-face {
    animation: none;
  }
}
