/* =========================================================
   reports.css — หน้ารายงานปริมาณการใช้น้ำ (design 1e)
   ชื่อ class ขึ้นต้น rpt- ทั้งหมด (CSS ทุกหน้าโหลดรวมกัน)
   ========================================================= */

.rpt-title {
    margin-right: auto;
    font-size: calc(20px * var(--k));
}

/* แถบตัวกรอง */
.rpt-filter {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: calc(14px * var(--k)) calc(18px * var(--k));
    padding: calc(12px * var(--k)) calc(16px * var(--k));
    border-radius: 8px;
    background: #f7f5f0;
}

.rpt-f {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rpt-lbl {
    font-size: calc(10.5px * var(--k));
    color: var(--c-ink-soft);
}

.rpt-filter .seg { background: #f2efe8; }

input.rpt-date {
    width: calc(130px * var(--k));
    height: calc(34px * var(--k));
    padding: 0 10px;
    border: 1px solid #d5cfc2;
    border-radius: 6.5px;
    background: #fff;
    color: var(--c-ink);
    font: inherit;
    font-size: calc(11.5px * var(--k));
    font-variant-numeric: tabular-nums;
    outline: none;
}

input.rpt-date:focus { border-color: var(--c-sidebar); }

.rpt-ym {
    display: flex;
    gap: 6px;
}

.rpt-ym select {
    height: calc(34px * var(--k));
    padding: 0 8px;
    border: 1px solid #d5cfc2;
    border-radius: 6.5px;
    background: #fff;
    color: var(--c-ink);
    font: inherit;
    font-size: calc(11.5px * var(--k));
    cursor: pointer;
}

.rpt-ym select:focus { outline: none; border-color: var(--c-sidebar); }

.rpt-note {
    margin-left: auto;
    align-self: center;
    font-size: calc(11px * var(--k));
    color: var(--c-ink-soft);
}

/* หัวตาราง */
.rpt-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.rpt-caption b { font-size: calc(14.5px * var(--k)); font-weight: 600; }
.rpt-caption span { font-size: calc(11px * var(--k)); color: var(--c-ink-soft); }

/* ตาราง: แต่ละแถวเป็น grid คอลัมน์เท่ากัน (style="grid-template-columns: ...") */
.rpt-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #e7e2d8;
    border-radius: 8px;
}

.rpt-row {
    display: grid;
    width: max-content;
    min-width: 100%;
    align-items: stretch;
    border-top: 1px solid var(--c-line);
    font-size: calc(12px * var(--k));
    font-variant-numeric: tabular-nums;
}

.rpt-row > span {
    display: flex;
    align-items: center;
    padding: calc(10px * var(--k)) 10px;
    background: #fff;
    white-space: nowrap;
}

.rpt-row > span.r { justify-content: flex-end; text-align: right; }
.rpt-row:not(.rpt-head):not(.rpt-foot):hover > span { background: #f7f5f0; }

/* คอลัมน์แรก / รวม / สัดส่วน ติดขอบเวลาเลื่อนซ้าย-ขวา */
.rpt-row > .rpt-c1 {
    position: sticky;
    left: 0;
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    padding-left: 16px;
    box-shadow: 1px 0 0 var(--c-line);
}

.rpt-c1 b { font-weight: 600; }

.rpt-c1 small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: calc(10px * var(--k));
    color: #8a938c;
}

.rpt-row > .rpt-tot {
    position: sticky;
    right: 118px;
    padding-right: 12px;
    background: #faf8f4;
}

.rpt-row > .rpt-pct {
    position: sticky;
    right: 0;
    gap: 6px;
    padding: 0 16px;
    box-shadow: -1px 0 0 var(--c-line);
}

.rpt-bar {
    width: 44px;
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: #f2efe8;
}

.rpt-bar > span {
    display: block;
    height: 100%;
    background: var(--c-chart);
}

.rpt-pct small {
    width: 30px;
    text-align: right;
    font-size: calc(10.5px * var(--k));
    color: var(--c-ink-soft);
}

/* หัว / แถวรวม ติดบน-ล่าง */
.rpt-head {
    position: sticky;
    top: 0;
    z-index: 2;
    border-top: 0;
}

.rpt-head > span {
    background: #f7f5f0;
    color: var(--c-ink-soft);
    font-size: calc(11px * var(--k));
    font-weight: 600;
}

.rpt-head > .rpt-tot { background: #efebe3; }

.rpt-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    border-top: 1.5px solid #e7e2d8;
    font-weight: 600;
}

.rpt-foot > span { background: #f7f5f0; }
.rpt-foot > .rpt-tot { background: #efebe3; }

/* ไม่มีข้อมูล / ผลต่างติดลบ */
.rpt-na { color: #b8b2a6; }
.rpt-neg { color: var(--c-err-fg); font-weight: 600; }

.rpt-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--c-ink-soft);
}

.rpt-hint {
    font-size: calc(11px * var(--k));
    color: var(--c-ink-soft);
}
