/* dash.css — แดชบอร์ดสาธารณะ + หลังบ้าน + รายงานพิมพ์ */

.admin-body, .dash-body { background: #f4f7f5; }
.admin-nav { background: linear-gradient(135deg, #198754, #0f5132); }
.admin-nav .nav-link { color: rgba(255,255,255,.8); border-radius: .5rem; padding: .45rem .7rem !important; white-space: nowrap; }
.admin-nav .nav-link:hover, .admin-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.14); }
.admin-nav .navbar-toggler { border-color: rgba(255,255,255,.4); }
.admin-nav .navbar-toggler-icon { filter: invert(1); }

.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.page-head .page-title { margin: 0; }
.filter-label { font-size: .85rem; color: #52514e; }

.auth-card { max-width: 420px; margin: 3rem auto; background: #fff; border-radius: 1.25rem; padding: 2rem; box-shadow: 0 8px 30px rgba(16, 80, 50, .08); }
.panel, .filter-card { background: #fff; border-radius: 1rem; padding: 1.1rem 1.25rem; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.filter-card { margin-bottom: 1.25rem; }
.panel-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .9rem; }

/* KPI */
.kpi { background: #fff; border-radius: 1rem; padding: 1rem 1.1rem; height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.05); position: relative; }
.kpi-icon { position: absolute; right: .9rem; top: .8rem; font-size: 1.4rem; opacity: .85; }
.kpi-value { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 700; color: #0b0b0b; line-height: 1.15; font-variant-numeric: tabular-nums; padding-right: 1.8rem; }
.kpi-label { font-size: .88rem; color: #52514e; margin-top: .25rem; font-weight: 500; }
.kpi-sub { font-size: .76rem; color: #8a8984; margin-top: .15rem; }

/* Section */
.section-h { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; font-weight: 700; margin: .5rem 0 1rem; }
.section-h span { width: 30px; height: 30px; border-radius: 50%; background: var(--gcs-green); color: #fff; display: grid; place-items: center; font-size: .9rem; }

/* Chart card */
.chart-card { background: #fff; border-radius: 1rem; padding: 1rem 1.1rem .8rem; height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.chart-title { font-size: .98rem; font-weight: 700; margin: 0 0 .25rem; color: #0b0b0b; }
.chart-note { font-size: .78rem; color: #8a8984; margin: 0 0 .5rem; }
.chart-wrap { position: relative; width: 100%; margin-top: .5rem; }
.chart-empty { color: #8a8984; font-size: .9rem; padding: 1.5rem 0; text-align: center; }
.chart-table { margin-top: .5rem; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--gcs-green-dark); font-weight: 500; font-size: .82rem; }
.chart-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table table { margin-top: .4rem; }

.score-row { display: grid; grid-template-columns: 1fr 34% 3rem; gap: .6rem; align-items: center; margin-top: .9rem; }
.score-label { font-size: .88rem; font-weight: 500; }
.score-bar { height: 10px; background: #ecebe8; border-radius: 999px; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: #2a78d6; border-radius: 999px; }
.score-val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.score-sub { font-size: .76rem; color: #8a8984; }

.research-strip { background: #fff; border-radius: 1rem; padding: .9rem 1.1rem; box-shadow: 0 1px 4px rgba(0,0,0,.05); font-size: .95rem; }
.insight-list { padding-left: 1.1rem; margin: .5rem 0 0; }
.insight-list li { margin-bottom: .45rem; }
.suggestion-list { max-height: 420px; overflow: auto; margin-top: .5rem; }
.suggestion-list blockquote { border-left: 3px solid #a3cfbb; padding: .3rem .8rem; margin: 0 0 .8rem; background: #f8fbf9; border-radius: 0 .5rem .5rem 0; }
.suggestion-list p { margin: 0 0 .2rem; }
.suggestion-list footer { font-size: .76rem; color: #8a8984; }
.method-note { font-size: .8rem; color: #6c757d; background: #fff; border-radius: .75rem; padding: .8rem 1rem; }

/* Table of responses */
.resp-table td, .resp-table th { white-space: nowrap; font-size: .9rem; }
.resp-table tbody tr { cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: minmax(150px, 34%) 1fr; gap: .1rem 1rem; }
.detail-grid dt { color: #6c757d; font-weight: 500; padding: .45rem 0; border-bottom: 1px solid #f0f2f1; }
.detail-grid dd { margin: 0; padding: .45rem 0; border-bottom: 1px solid #f0f2f1; }

/* Export */
.export-card { border: 1.5px solid #e3ece6; border-radius: 1rem; padding: 1rem; height: 100%; background: #fff; display: flex; flex-direction: column; }
.export-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; }
.export-card p { font-size: .82rem; color: #6c757d; flex-grow: 1; }

/* Public dashboard header */
.dash-hero { background: linear-gradient(135deg, #198754 0%, #0f5132 100%); color: #fff; padding: 1.5rem 0 4.5rem; }
.dash-hero + .container-xl { margin-top: -3.5rem; }

/* Report (A4) */
.report-head { background: #fff; border-radius: 1rem; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.report-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0 0 .25rem; }

@media print {
    @page { size: A4; margin: 12mm 10mm; }
    body, .admin-body, .dash-body { background: #fff !important; font-size: 11pt; }
    .no-print, .admin-nav, .filter-card, .chart-table summary, .btn, footer.site-footer { display: none !important; }
    .chart-table[open] { display: none; }
    main.container-xl, .container-xl { max-width: none !important; padding: 0 !important; margin: 0 !important; }
    .dash-hero { padding: .5rem 0; background: #fff !important; color: #000 !important; }
    .dash-hero + .container-xl { margin-top: 0; }
    .kpi, .chart-card, .panel, .research-strip, .report-head, .method-note { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
    .section-h { break-after: avoid; page-break-after: avoid; margin-top: .8rem; }
    .section-h + .row { break-before: avoid; page-break-before: avoid; }
    .row > [class*="col-"] { break-inside: avoid; }
    .col-lg-6, .col-lg-5, .col-lg-7 { flex: 0 0 50% !important; max-width: 50% !important; }
    .col-lg-3 { flex: 0 0 25% !important; max-width: 25% !important; }
    .suggestion-list { max-height: none; overflow: visible; }
    .print-page-break { break-before: page; }
    /* กราฟย่อ/ขยายตามความกว้างการ์ดบนกระดาษ (ภาพมีความละเอียด 2 เท่า จึงยังคมชัด) */
    .chart-wrap { height: auto !important; }
    .chart-wrap canvas { width: 100% !important; height: auto !important; max-width: 100%; }
    .chart-card { overflow: hidden; }
    a { color: inherit; text-decoration: none; }
}
