/* =========================================================
   MY VILLAGE WALK — Premium Design System
   Dark luxury · Emerald + Champagne Gold · Glassmorphism
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&family=Inter:wght@500;600;700;800&display=swap');

:root {
    --bg-0: #05080F;
    --bg-1: #0A0F1A;
    --bg-2: #0F1626;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text: #F1F5F9;
    --text-dim: #94A3B8;
    --text-faint: #64748B;

    --emerald: #34D399;
    --emerald-deep: #059669;
    --emerald-glow: rgba(52, 211, 153, 0.35);
    --gold: #E6C887;
    --gold-deep: #B8924A;
    --danger: #F87171;

    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;

    --font: 'Sarabun', 'Inter', system-ui, sans-serif;
    --font-num: 'Inter', 'Sarabun', system-ui, sans-serif;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

::selection { background: var(--emerald-glow); color: #fff; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* Aurora background (shared) */
.aurora {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
    background: radial-gradient(120% 80% at 50% 0%, #0C1424 0%, var(--bg-0) 60%);
}
.aurora::before, .aurora::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(110px); opacity: 0.55;
    animation: drift 22s ease-in-out infinite alternate;
}
.aurora::before { width: 560px; height: 560px; background: #10B981; top: -180px; left: -120px; opacity: 0.28; }
.aurora::after  { width: 520px; height: 520px; background: var(--gold-deep); bottom: -200px; right: -120px; opacity: 0.18; animation-delay: -8s; }
@keyframes drift { to { transform: translate(80px, 60px) scale(1.15); } }

/* Grain overlay for tactile depth */
.grain {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* =========================================================
   LOGIN
   ========================================================= */
.auth-shell {
    position: relative; z-index: 2;
    height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}

.brand-panel {
    padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
    border-right: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(16,185,129,0.08), transparent 55%);
}
.brand-mark { display: flex; align-items: center; gap: 14px; }
.brand-mark .mark {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    background: linear-gradient(145deg, var(--emerald), var(--emerald-deep));
    box-shadow: 0 10px 30px var(--emerald-glow), inset 0 1px 0 rgba(255,255,255,0.35);
}
.brand-mark .mark svg { width: 24px; height: 24px; stroke: #04130D; }
.brand-mark span { font-family: var(--font-num); font-weight: 800; letter-spacing: 3px; font-size: 14px; }

.brand-hero h1 {
    font-size: clamp(30px, 3.6vw, 56px); line-height: 1.2; font-weight: 800; letter-spacing: -1px;
    white-space: nowrap;
}
.brand-hero h1 em {
    font-style: normal;
    display: inline-block;            /* ให้พื้นที่ gradient ครอบสระล่างของภาษาไทย */
    padding: 0.12em 0 0.28em;
    margin: -0.12em 0 -0.28em;
    background: linear-gradient(110deg, var(--gold) 0%, #FFF3D1 45%, var(--gold-deep) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-hero p { margin-top: 20px; color: var(--text-dim); font-size: clamp(13px, 1.15vw, 17px); font-weight: 300; white-space: nowrap; }
@media (max-width: 1200px) {
    .brand-hero p { white-space: normal; max-width: 460px; }
}

.brand-points { display: grid; gap: 14px; }
.brand-points div { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 14px; }
.brand-points i {
    width: 8px; height: 8px; border-radius: 50%; background: var(--emerald);
    box-shadow: 0 0 12px var(--emerald);
}

.form-panel { display: grid; place-items: center; padding: 32px; }

.login-card {
    width: 100%; max-width: 440px; padding: 44px 40px; border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 40px 80px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    animation: rise 0.8s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

.login-card h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.3px; }
.login-card .sub { color: var(--text-dim); margin: 6px 0 32px; }

.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.3px; }
.field .control { position: relative; }
.field input {
    width: 100%; padding: 15px 18px; border-radius: 14px; font: inherit; font-size: 15px; color: var(--text);
    background: rgba(5, 8, 15, 0.55); border: 1px solid var(--border-strong); outline: none;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.field input::placeholder { color: var(--text-faint); }
.field input:focus { border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(52,211,153,0.12); background: rgba(5,8,15,0.8); }
.toggle-pass {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 8px; border-radius: 10px;
    display: grid; place-items: center; transition: color .2s, background .2s;
}
.toggle-pass:hover { color: var(--text); background: var(--surface-hover); }
.toggle-pass svg { width: 20px; height: 20px; }

.btn-primary {
    position: relative; width: 100%; margin-top: 8px; padding: 16px; border: none; border-radius: 14px; cursor: pointer;
    font: inherit; font-size: 16px; font-weight: 700; color: #03150E; letter-spacing: 0.4px;
    background: linear-gradient(135deg, #6EE7B7 0%, var(--emerald) 45%, var(--emerald-deep) 100%);
    box-shadow: 0 12px 30px var(--emerald-glow), inset 0 1px 0 rgba(255,255,255,0.5);
    transition: transform .25s var(--ease), box-shadow .25s, filter .25s; overflow: hidden;
}
.btn-primary::after {
    content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent); transform: skewX(-20deg);
    transition: left .7s var(--ease);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px var(--emerald-glow), inset 0 1px 0 rgba(255,255,255,0.5); }
.btn-primary:hover::after { left: 160%; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { cursor: not-allowed; filter: saturate(0.6) brightness(0.85); transform: none; }
.btn-primary .spinner { display: none; }
.btn-primary.loading .label { opacity: 0; }
.btn-primary.loading .spinner {
    display: block; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px;
    border: 3px solid rgba(3,21,14,0.25); border-top-color: #03150E; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-message {
    min-height: 22px; margin-top: 18px; text-align: center; font-size: 14px; font-weight: 500; color: var(--danger);
}
.error-message.show { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.login-foot { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-faint); }

/* =========================================================
   APP SHELL
   ========================================================= */
.dashboard-container { position: relative; z-index: 2; display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 272px; flex-shrink: 0; height: 100%; padding: 28px 20px;
    display: flex; flex-direction: column; justify-content: space-between;
    background: rgba(10, 15, 26, 0.72); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border); overflow-y: auto;
}

.logo-small { display: flex; align-items: center; gap: 12px; padding: 0 10px; margin-bottom: 36px; }
.logo-small .mark {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    background: linear-gradient(145deg, var(--emerald), var(--emerald-deep));
    box-shadow: 0 8px 24px var(--emerald-glow), inset 0 1px 0 rgba(255,255,255,0.35);
}
.logo-small .mark svg { width: 21px; height: 21px; stroke: #04130D; }
.logo-small h2 { font-family: var(--font-num); font-size: 15px; font-weight: 800; letter-spacing: 2px; line-height: 1.2; }
.logo-small h2 small { display: block; font-family: var(--font); font-size: 11px; font-weight: 400; letter-spacing: 0.5px; color: var(--text-faint); }

.nav-label { padding: 0 14px; margin-bottom: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--text-faint); text-transform: uppercase; }

.sidebar nav a {
    position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 4px;
    color: var(--text-dim); text-decoration: none; font-weight: 500; font-size: 15px; border-radius: 14px;
    transition: color .2s, background .2s, transform .2s var(--ease);
}
.sidebar nav a svg { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; }
.sidebar nav a:hover { color: var(--text); background: var(--surface-hover); transform: translateX(3px); }
.sidebar nav a.active {
    color: var(--emerald); background: linear-gradient(90deg, rgba(52,211,153,0.14), rgba(52,211,153,0.02));
    font-weight: 600;
}
.sidebar nav a.active::before {
    content: ''; position: absolute; left: -20px; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0;
    background: var(--emerald); box-shadow: 0 0 14px var(--emerald);
}

.user-info {
    margin-top: 24px; padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
}
.user-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-width: 0; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    font-weight: 700; font-size: 16px; color: #1B1303;
    background: linear-gradient(145deg, #F4DFAE, var(--gold-deep));
    box-shadow: 0 0 0 2px rgba(230,200,135,0.25);
    font-size: 0; color: transparent;   /* ซ่อนตัวอักษรที่ JS ใส่มา แล้วใช้ไอคอนคนแทน */
}
.avatar::before {
    content: ''; width: 22px; height: 22px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B1303' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/></svg>") center / contain no-repeat;
}
.user-meta { min-width: 0; }
.user-meta #userName { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--text-faint); font-size: 12px; }
.btn-logout {
    width: 100%; padding: 10px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
    color: var(--danger); background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.18);
    transition: background .2s, color .2s;
}
.btn-logout:hover { background: var(--danger); color: #1A0505; }

/* Main */
.main-content { flex: 1; height: 100%; overflow-y: auto; padding: 44px 48px 56px; }
.page { max-width: 1240px; margin: 0 auto; }

.page-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
    gap: 20px; 
    flex-wrap: wrap; 
    margin-bottom: 36px; 
}
.page-header > div:first-child {
    flex: 1;
    min-width: 0;
    overflow: visible;    /* บังคับให้แสดงส่วนที่ล้นออกมา */
    padding: 8px 0;       /* เพิ่มพื้นที่บน-ล่างให้กล่อง */
}
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--gold); text-transform: uppercase; margin-bottom: 10px; }
.page-header h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.15; }
.page-header h1 span { background: linear-gradient(110deg, var(--emerald), #A7F3D0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-header p { margin-top: 8px; color: var(--text-dim); }
.date-chip {
    padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-dim);
    background: var(--surface); border: 1px solid var(--border);
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }

.stat-card {
    position: relative; padding: 24px; border-radius: var(--radius); overflow: hidden; min-width: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform .35s var(--ease), border-color .35s, box-shadow .35s;
    animation: rise .7s var(--ease) both;
}
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .18s; }
.stat-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: 0 28px 50px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08); }

.stat-icon {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 20px;
    background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.2); color: var(--emerald);
}
.stat-icon svg { width: 22px; height: 22px; stroke: currentColor; }
.stat-value {
    display: block; font-family: var(--font-num); font-size: 32px; font-weight: 800; letter-spacing: -1px;
    line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.stat-value small { font-size: 15px; font-weight: 600; color: var(--text-faint); letter-spacing: 0; margin-left: 4px; }

.stat-card.primary {
    background: linear-gradient(145deg, #0B5D43 0%, #10B981 100%); border: none;
    box-shadow: 0 24px 50px rgba(16,185,129,0.28), inset 0 1px 0 rgba(255,255,255,0.3);
}
.stat-card.primary::after {
    content: ''; position: absolute; width: 220px; height: 220px; right: -70px; top: -90px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.28), transparent 70%);
}
.stat-card.primary .stat-icon { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.28); color: #fff; }
.stat-card.primary .stat-label, .stat-card.primary .stat-value small { color: rgba(255,255,255,0.8); }

/* Panels */
.panel-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; margin-bottom: 20px; }
.panel {
    padding: 28px; border-radius: var(--radius); min-width: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: rise .8s var(--ease) .2s both;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 22px; gap: 12px; }
.panel-head h2 { font-size: 18px; font-weight: 700; }
.panel-head span { font-size: 13px; color: var(--text-faint); }

.chart-wrapper { position: relative; height: 320px; width: 100%; }
.chart-wrapper canvas { width: 100% !important; height: 100% !important; }

/* Goal ring */
.ring-wrap { display: grid; place-items: center; position: relative; margin: 4px 0 18px; }
.ring { width: 190px; height: 190px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255,255,255,0.07); stroke-width: 12; }
.ring .bar {
    fill: none; stroke: url(#ringGrad); stroke-width: 12; stroke-linecap: round;
    stroke-dasharray: 502.65; stroke-dashoffset: 502.65; transition: stroke-dashoffset 1.6s var(--ease);
    filter: drop-shadow(0 0 8px rgba(52,211,153,0.5));
}
.ring-center { position: absolute; text-align: center; }
.ring-center b { display: block; font-family: var(--font-num); font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.ring-center span { font-size: 12px; color: var(--text-dim); }
.goal-note { text-align: center; font-size: 14px; color: var(--text-dim); }
.goal-note b { color: var(--gold); font-family: var(--font-num); }

/* Recent list */
.recent { animation: rise .8s var(--ease) .3s both; }
.recent-list { display: grid; gap: 4px; }
.recent-item {
    display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 16px;
    padding: 14px; border-radius: 16px; transition: background .2s;
}
.recent-item:hover { background: var(--surface-hover); }
.recent-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(52,211,153,0.1); color: var(--emerald); }
.recent-ic svg { width: 20px; height: 20px; stroke: currentColor; }
.recent-main b { display: block; font-weight: 600; font-size: 15px; }
.recent-main small { color: var(--text-faint); font-size: 13px; }
.recent-dist { text-align: right; font-family: var(--font-num); font-weight: 700; font-size: 17px; }
.recent-dist small { display: block; font-family: var(--font); font-weight: 400; font-size: 12px; color: var(--text-faint); }

.empty { padding: 36px 12px; text-align: center; color: var(--text-faint); }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; color: transparent !important; background: rgba(255,255,255,0.06); border-radius: 8px; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.09), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Toast */
.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 30px); opacity: 0; z-index: 50;
    padding: 14px 22px; border-radius: 14px; font-size: 14px; font-weight: 500;
    background: rgba(15,22,38,0.92); border: 1px solid var(--border-strong); backdrop-filter: blur(14px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5); transition: all .4s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
    .panel-grid { grid-template-columns: 1fr; }
    .main-content { padding: 36px 32px 48px; }
}

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel { display: none; }
}

@media (max-width: 768px) {
    body { overflow: auto; }
    .dashboard-container { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
    .sidebar {
        position: fixed; bottom: 0; left: 0; right: 0; top: auto; z-index: 20; width: 100%; height: auto;
        flex-direction: row; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        border-right: none; border-top: 1px solid var(--border-strong); overflow: visible;
    }
    .sidebar > div:first-child { width: 100%; }
    .logo-small, .nav-label, .user-info { display: none; }
    .sidebar nav { display: flex; justify-content: space-around; }
    .sidebar nav a { flex-direction: column; gap: 4px; padding: 8px 10px; margin: 0; font-size: 11px; transform: none !important; }
    .sidebar nav a.active::before { display: none; }
    .main-content { height: auto; overflow: visible; padding: 24px 18px 110px; }
    .page-header h1 { font-size: 28px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .stat-card { padding: 18px; }
    .stat-value { font-size: 26px; }
    .chart-wrapper { height: 260px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 34px 24px; }
    .panel { padding: 22px; }
}

/* =========================================================
   TABLE & BADGE (สำหรับหน้า History)
   ========================================================= */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--surface-hover);
    color: var(--text);
}

.data-table td b {
    color: var(--text);
    font-family: var(--font-num);
    font-size: 15px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge.pending {
    background: rgba(230, 200, 135, 0.15);
    color: var(--gold);
    border: 1px solid rgba(230, 200, 135, 0.3);
}

/* =========================================================
   RECORDS (สำหรับหน้า Analytics)
   ========================================================= */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.record-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.25s var(--ease), border-color 0.25s;
}

.record-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
}

.record-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(230, 200, 135, 0.1);
    border: 1px solid rgba(230, 200, 135, 0.2);
    flex-shrink: 0;
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.record-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.record-value {
    font-family: var(--font-num);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

/* =========================================================
   DAILY GOALS (สำหรับหน้า Goals)
   ========================================================= */
.daily-goals-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .daily-goals-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .daily-goals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   OVERVIEW HEADER (ปรับขนาดเฉพาะหน้า Overview)
   ========================================================= */
.page-header h1.overview-greeting {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    
    /* ค่าที่สำคัญสำหรับภาษาไทย */
    line-height: 1.8;     /* เพิ่มความสูงของบรรทัดให้มากพอ (1.6 - 2.0) */
    padding: 4px 0;       /* เพิ่มพื้นที่รอบตัวอักษร */
    
    /* ลบการซ่อนข้อความออก */
    overflow: visible;    /* ไม่ให้ตัดข้อความ */
    white-space: normal;  /* ยอมให้ตัดบรรทัดได้ (ถ้าข้อความยาวเกิน) */
    word-break: break-word;
}

/* บังคับให้ทุกอย่างใน Header แสดงผลได้ครบ */
.page-header, 
.page-header > div, 
.page-header h1 {
    overflow: visible !important;
    height: auto !important;
    min-height: fit-content !important;
}

/* =========================================================
   MODAL (ยืนยันออกจากระบบ)
   ========================================================= */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
    background: rgba(3, 6, 12, 0.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
    width: 100%; max-width: 400px; padding: 36px 32px 28px; text-align: center; border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 22, 38, 0.95));
    border: 1px solid var(--border-strong);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(16px) scale(0.96); transition: transform .35s var(--ease);
}
.modal-overlay.show .modal { transform: none; }

.modal-icon {
    width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 18px; display: grid; place-items: center;
    color: var(--danger); background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.22);
}
.modal-icon svg { width: 26px; height: 26px; }
.modal h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 8px; }
.modal p { color: var(--text-dim); font-size: 15px; margin-bottom: 28px; }

.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions button {
    padding: 13px; border-radius: 14px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600;
    transition: transform .2s var(--ease), background .2s, color .2s, box-shadow .2s;
}
.modal-actions button:active { transform: scale(0.97); }
.btn-ghost { color: var(--text); background: var(--surface-hover); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn-danger { color: #1A0505; background: var(--danger); border: 1px solid transparent; box-shadow: 0 10px 24px rgba(248, 113, 113, 0.3); }
.btn-danger:hover { background: #FCA5A5; box-shadow: 0 14px 30px rgba(248, 113, 113, 0.4); }
.modal-actions button:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
