/* ══ แดชบอร์ด AR (ลูกหนี้) — สไตล์ Glass / ฟ้าอ่อน (2026-10-06) ══ */
#page-dashboard-ar, #page-dashboard-ap { --ard-blue: #2F6FED; --ard-ink: #0F172A; --ard-muted: #64748B; --ard-line: #E6EBF2; --ard-card: rgba(255,255,255,.86); }
.ard2-hero {
  position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 16px; min-height: 196px;
  background: linear-gradient(90deg, #F7FAFF 0%, rgba(247,250,255,.92) 42%, rgba(247,250,255,0) 72%), url("../dashboard/hero-docs.webp") right center / cover no-repeat, #EEF3FB;
  border: 1px solid var(--ard-line); padding: 22px 26px;
}
.ard2-crumb { font-size: 12.5px; color: var(--ard-muted); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ard2-title { font-size: 34px; line-height: 1.15; font-weight: 800; color: var(--ard-ink); margin: 0 0 6px; letter-spacing: -.3px; }
.ard2-title span { color: var(--ard-blue); }
.ard2-sub { color: var(--ard-muted); font-size: 13.5px; max-width: 520px; margin: 0 0 14px; }
.ard2-period { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--ard-line); border-radius: 10px; padding: 4px 6px 4px 12px; box-shadow: 0 2px 8px rgba(15,23,42,.05); }
.ard2-period i { color: var(--ard-blue); }
.ard2-period select { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--ard-ink); padding: 4px 4px; outline: none; }

.ard2-kpis { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.ard2-kpi {
  position: relative; border-radius: 16px; padding: 18px 18px 16px; background: var(--ard-card); border: 1px solid var(--ard-line);
  box-shadow: 0 6px 20px rgba(30,64,175,.06); display: flex; gap: 14px; align-items: center; min-height: 112px; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.ard2-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30,64,175,.1); }
.ard2-kpi img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(47,111,237,.18)); }
.ard2-kpi small { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.ard2-kpi b { display: block; font-size: 24px; font-weight: 800; color: var(--ard-ink); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.ard2-kpi em { font-style: normal; font-size: 12px; color: var(--ard-muted); }
.ard2-kpi em .up { color: #16A34A; } .ard2-kpi em .down { color: #DC2626; }
.ard2-kpi .ard2-go { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--ard-ink); background: rgba(255,255,255,.8); font-size: 14px; }
.ard2-kpi.is-dark { background: linear-gradient(135deg, #0B1530 0%, #12285A 100%); border-color: #0B1530; }
.ard2-kpi.is-dark small, .ard2-kpi.is-dark b { color: #fff; } .ard2-kpi.is-dark em { color: #A9B8D6; } .ard2-kpi.is-dark .ard2-go { background: rgba(255,255,255,.14); color: #fff; }
.ard2-kpi.is-dark em .up { color: #4ADE80; }
.ard2-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.ard2-mini > div { border-radius: 14px; padding: 12px 14px; background: var(--ard-card); border: 1px solid var(--ard-line); display: flex; gap: 12px; align-items: center; cursor: pointer; }
.ard2-mini i.ti { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: var(--ard-blue); background: linear-gradient(135deg, #EEF4FF, #DCE7FF); flex-shrink: 0; }
.ard2-mini small { display: block; font-size: 12px; color: #334155; font-weight: 600; }
.ard2-mini b { font-size: 19px; font-weight: 800; color: var(--ard-ink); font-variant-numeric: tabular-nums; }
.ard2-mini b span { font-size: 12px; font-weight: 500; color: var(--ard-muted); margin-left: 3px; }

.ard2-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.ard2-grid.g3 { grid-template-columns: 1.25fr 1.15fr .8fr; }
.ard2-grid.g2 { grid-template-columns: 1fr 1.1fr; }
.ard2-card { border-radius: 16px; background: var(--ard-card); border: 1px solid var(--ard-line); padding: 16px 18px; box-shadow: 0 6px 20px rgba(30,64,175,.05); min-width: 0; }
.ard2-card h3 { font-size: 15px; font-weight: 700; color: var(--ard-ink); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.ard2-card h3 i { color: var(--ard-blue); font-size: 18px; }
.ard2-card h3 .ard2-more { margin-left: auto; font-size: 12px; font-weight: 600; border: 1px solid var(--ard-line); border-radius: 8px; padding: 4px 10px; background: #fff; color: var(--ard-ink); cursor: pointer; }
.ard2-aging { display: flex; gap: 16px; align-items: center; }
.ard2-donut { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.ard2-donut svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.ard2-donut .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ard2-donut .c small { display: block; font-size: 11px; color: var(--ard-muted); }
.ard2-donut .c b { font-size: 16px; font-weight: 800; color: var(--ard-ink); }
.ard2-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ard2-tbl th { text-align: left; font-weight: 600; color: var(--ard-muted); padding: 6px 8px; background: #F6F8FC; }
.ard2-tbl td { padding: 7px 8px; border-bottom: 1px solid #F0F3F8; color: #1E293B; }
.ard2-tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.ard2-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: middle; }
.ard2-bars svg { width: 100%; height: 190px; display: block; }
.ard2-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ard-muted); justify-content: flex-end; margin: -6px 0 6px; }
.ard2-ai { position: relative; border-radius: 16px; padding: 20px; color: #fff; overflow: hidden; background: radial-gradient(120% 90% at 100% 0%, #1E3A8A 0%, #0B1530 60%); display: flex; flex-direction: column; justify-content: flex-end; min-height: 230px; }
.ard2-ai img { position: absolute; right: -10px; top: -6px; width: 170px; opacity: .95; }
.ard2-ai .ai-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); margin-bottom: auto; font-size: 20px; }
.ard2-ai h4 { font-size: 17px; font-weight: 700; margin: 12px 0 4px; color: #fff; }
.ard2-ai p { font-size: 12.5px; color: #C7D2FE; margin: 0 0 12px; }
.ard2-ai button { border: 0; border-radius: 10px; background: #fff; color: #0B1530; font-weight: 700; padding: 9px 14px; display: flex; justify-content: center; gap: 8px; align-items: center; cursor: pointer; }
.ard2-bar { height: 8px; border-radius: 6px; background: #EEF2F8; overflow: hidden; min-width: 80px; }
.ard2-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #93B4FF, #2F6FED); }
.ard2-st { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.ard2-st.is-over { background: #FDECEC; color: #B42318; } .ard2-st.is-ok { background: #E8F5E9; color: #1B5E20; } .ard2-st.is-draft { background: #FFF4E0; color: #B26A00; }
.ard2-empty { color: var(--ard-muted); text-align: center; padding: 22px 0; font-size: 12.5px; }

@media (max-width: 1200px) { .ard2-kpis { grid-template-columns: repeat(2, 1fr); } .ard2-mini { grid-template-columns: repeat(3, 1fr); } .ard2-grid.g3, .ard2-grid.g2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ard2-kpis, .ard2-mini { grid-template-columns: 1fr; } .ard2-title { font-size: 26px; } .ard2-aging { flex-direction: column; } }

/* Dark */
[data-theme="dark"] #page-dashboard-ar, [data-theme="dark"] #page-dashboard-ap { --ard-ink: #E5E7EB; --ard-muted: #9AA4B2; --ard-line: #2C3137; --ard-card: rgba(30,34,39,.92); }
[data-theme="dark"] .ard2-hero { background: linear-gradient(90deg, #161A1F 0%, rgba(22,26,31,.92) 45%, rgba(22,26,31,.2) 80%), url("../dashboard/hero-docs.webp") right center / cover no-repeat, #161A1F; }
[data-theme="dark"] .ard2-period, [data-theme="dark"] .ard2-card h3 .ard2-more { background: #1E2227; }
[data-theme="dark"] .ard2-kpi small, [data-theme="dark"] .ard2-mini small { color: #C6CCD3; }
[data-theme="dark"] .ard2-tbl th { background: #262B31; } [data-theme="dark"] .ard2-tbl td { border-color: #2C3137; color: #E5E7EB; }
[data-theme="dark"] .ard2-mini i.ti { background: #24304A; color: #93B4FF; }

/* แถบเมนูข้าง: ภาพคลื่นด้านล่าง + ข้อความแบรนด์ */
.sidebar { background-image: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)), url("../dashboard/sidebar-wave.webp"); background-repeat: no-repeat; background-position: left bottom; background-size: 100% auto; }
.sidebar-tagline { position: sticky; bottom: 0; padding: 40px 18px 14px; font-size: 13px; line-height: 1.35; color: #8C9AB2; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(255,255,255,0)); }
.sidebar.collapsed .sidebar-tagline { display: none; }
[data-theme="dark"] .sidebar { background-image: linear-gradient(rgba(22,26,31,.82), rgba(22,26,31,.82)), url("../dashboard/sidebar-wave.webp"); }
