/* rbnd-tienich.css — các công cụ ở menu "Tiện ích":
   /tinh-lai-suat-vay-mua-nha, /xem-tuoi-lam-nha, /tra-cuu-dia-gioi-hanh-chinh
   Máy tính là mặc định; điện thoại/máy tính bảng (< 992px) ghi đè ở cuối tệp.
   Biến màu (--rbnd-*) và .form-row/.form-grid/.btn-primary lấy từ rbnd-app.css. */

.tienich-page { padding-top: 24px; padding-bottom: 48px; }
.tienich-page h1 { font-size: 1.7rem; margin-bottom: 8px; }
.tienich-page .lead { font-size: 1.02rem; color: #495057; margin-bottom: 22px; }

.ti-card {
    background: #fff; border: 1px solid var(--rbnd-border); border-radius: var(--rbnd-radius);
    padding: 20px 22px 22px;
}
.ti-card .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.ti-words { margin: 6px 0 0; min-height: 1.3em; font-size: .85rem; color: var(--rbnd-primary); font-style: italic; }
.tienich-page .hint { color: var(--rbnd-muted); font-size: .82rem; margin: 6px 0 0; }

/* ---------- Ô nhập kèm đơn vị ---------- */
.ti-pair { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 10px; }
.ti-input-unit { position: relative; }
.ti-input-unit input { padding-right: 62px !important; }
.ti-input-unit--pct input { padding-right: 34px !important; }
.ti-input-unit > span {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: .82rem; color: var(--rbnd-muted); pointer-events: none;
}

/* ---------- Nút chọn nhanh ---------- */
.ti-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ti-chips--tight { margin: -6px 0 4px; }
.ti-chip {
    border: 1px solid var(--rbnd-border); background: #f6f8f7; color: #343a40; border-radius: 999px;
    padding: 4px 13px; font-size: .84rem; cursor: pointer;
}
.ti-chip:hover { border-color: var(--rbnd-primary); color: var(--rbnd-primary); background: #e6f4ec; }
.ti-chip:focus-visible { outline: 2px solid var(--rbnd-primary); outline-offset: 2px; }

/* ---------- Cách trả nợ ---------- */
.ti-method { border: 0; padding: 0; margin: 14px 0 18px; }
.ti-method legend { font-weight: 500; font-size: 1rem; margin-bottom: 8px; }
.ti-radio {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
    border: 1px solid var(--rbnd-border); border-radius: 10px; cursor: pointer;
}
.ti-radio:has(input:checked) { border-color: var(--rbnd-primary); background: #f0f8f4; }
.ti-radio input { margin-top: 4px; accent-color: var(--rbnd-primary); }
.ti-radio span { font-size: .93rem; line-height: 1.4; }
.ti-radio small { display: block; color: var(--rbnd-muted); font-size: .8rem; }
.ti-submit { width: 100%; }

/* ---------- Kết quả vay ---------- */
.ti-hero {
    background: linear-gradient(135deg, #0a603d, #0d7a4e); color: #fff;
    border-radius: var(--rbnd-radius); padding: 20px 24px; margin-bottom: 14px;
}
.ti-hero p { margin: 0; }
.ti-hero__label { font-size: .9rem; opacity: .9; }
.ti-hero__value { font-size: 2.3rem; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ti-hero__sub { font-size: .88rem; opacity: .92; margin-top: 2px; }

.ti-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ti-stat {
    background: #fff; border: 1px solid var(--rbnd-border); border-radius: 10px; padding: 11px 14px; min-width: 0;
}
.ti-stat__label { display: block; font-size: .8rem; color: var(--rbnd-muted); margin-bottom: 2px; }
.ti-stat strong { display: block; font-size: 1.08rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ti-stat small { display: block; margin-top: 2px; font-size: .76rem; color: var(--rbnd-muted); line-height: 1.35; }

/* Thanh phân đoạn mảnh gốc / lãi: khe 2px màu nền giữa hai đoạn, hai đầu bo tròn */
.ti-split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 18px 0 8px; background: #fff; }
.ti-split__p { background: #0a603d; }
.ti-split__i { background: #e8890c; margin-left: 2px; }
.ti-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; padding: 0; margin: 0 0 6px; font-size: .88rem; }
.ti-legend--center { justify-content: center; margin-top: 8px; }
.ti-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: .05em; }
.ti-dot--p, .ti-dot--good { background: #0a603d; }
.ti-dot--i { background: #e8890c; }
.ti-dot--bad { background: #c0392b; }

.ti-table-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.ti-table-head h2 { font-size: 1.1rem; margin: 0; }
.ti-link-btn {
    border: 0; background: none; padding: 0; color: var(--rbnd-primary); font-weight: 600;
    text-decoration: underline; cursor: pointer; font-size: .9rem;
}
.ti-table-wrap { max-height: 380px; overflow: auto; border: 1px solid var(--rbnd-border); border-radius: 10px; }
.ti-table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.ti-table th, .ti-table td { padding: 7px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid #eef0f2; }
.ti-table thead th { position: sticky; top: 0; background: #f6f8f7; z-index: 1; font-weight: 600; }
.ti-table tbody th { text-align: center; font-weight: 600; color: #495057; background: #fafbfb; }
.ti-table thead th:first-child { text-align: center; }
.ti-note { margin: 14px 0 0; font-size: .8rem; line-height: 1.5; color: var(--rbnd-muted); }
.ti-note i { margin-right: 4px; }

/* ---------- Bài giải thích (SEO) ---------- */
.ti-article { margin-top: 38px; max-width: 820px; }
.ti-article h2 { font-size: 1.2rem; margin: 22px 0 8px; }
.ti-article p, .ti-article li { color: #343a40; line-height: 1.65; }

/* =========================================================================
 *  Xem tuổi làm nhà
 * ====================================================================== */
.ti-pt__form { margin-bottom: 26px; }
.ti-band {
    background: var(--rbnd-primary); color: #fff; text-align: center;
    border-radius: 8px; padding: 9px 12px; margin-top: 30px;
}
.ti-band h2 { font-size: 1.15rem; text-transform: uppercase; margin: 0; letter-spacing: .02em; }

.ti-factor { height: 100%; border-radius: 12px; padding: 14px 16px; border: 1px solid; }
.ti-factor h3 { font-size: 1.05rem; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
.ti-factor p { margin: 0; font-size: .92rem; line-height: 1.55; }
.ti-factor.is-ok  { background: #e6f4ec; border-color: #b9dfc9; }
.ti-factor.is-bad { background: #fdecea; border-color: #f2bcb8; }
.ti-factor.is-ok h3 i  { color: #006300; }
.ti-factor.is-bad h3 i { color: #c0392b; }
.ti-ok  { color: #006300; }
.ti-bad { color: #b42318; }
.ti-ok-t  { color: #006300; font-weight: 700; margin: 18px 0 6px; }
.ti-bad-t { color: #b42318; font-weight: 700; margin: 18px 0 6px; }

.ti-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 20px 0 4px; }
.ti-facts > div { background: #f6f8f7; border-radius: 10px; padding: 10px 14px; }
.ti-facts dt { font-size: .78rem; font-weight: 500; color: var(--rbnd-muted); }
.ti-facts dd { margin: 2px 0 0; font-weight: 700; }

/* La bàn Bát Trạch: tốt = nền xanh nhạt + viền xanh, xấu = nền đỏ nhạt + viền đỏ; có chữ "tốt/xấu" nên không dựa riêng vào màu */
.ti-compass { width: 100%; max-width: 340px; height: auto; }
.ti-compass__cell { stroke-width: 1.5; }
.ti-compass__cell.is-good { fill: #e6f4ec; stroke: #0a603d; }
.ti-compass__cell.is-bad  { fill: #fdecea; stroke: #c0392b; }
.ti-compass__dir  { font-size: 12px; font-weight: 700; fill: #212529; }
.ti-compass__star { font-size: 11px; fill: #343a40; }
.ti-compass__tag  { font-size: 10px; fill: #6c757d; text-transform: uppercase; letter-spacing: .04em; }
.ti-compass__core { fill: #0a603d; }
.ti-compass__core-t1 { font-size: 11px; fill: #cfe8da; }
.ti-compass__core-t2 { font-size: 17px; font-weight: 700; fill: #fff; }

.ti-h3 { font-size: 1.08rem; margin: 6px 0 8px; }
.ti-swatches { display: flex; flex-wrap: wrap; gap: 14px; list-style: none; padding: 0; margin: 0 0 12px; }
.ti-swatches li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.ti-swatch { width: 38px; height: 38px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .15); }

.ti-guide { margin-top: 26px; }
.ti-guide .ti-h3 { margin-top: 22px; }
.ti-stars { padding-left: 1.2rem; }
.ti-stars > li { margin-bottom: 10px; line-height: 1.6; }
.ti-stars ul { margin: 6px 0 0; }

/* =========================================================================
 *  Điện thoại / máy tính bảng (< 992px) — giao diện máy tính giữ nguyên
 * ====================================================================== */
@media (max-width: 991.98px) {
    .tienich-page { padding-top: 16px; padding-bottom: 36px; }
    .tienich-page h1 { font-size: 1.4rem; }
    .ti-card { padding: 16px 14px 18px; }
    .ti-hero { padding: 16px 16px; }
    .ti-hero__value { font-size: 1.9rem; }
    .ti-stats { grid-template-columns: minmax(0, 1fr); }
    .ti-radio { padding: 12px; }
    .ti-chip { padding: 7px 14px; }                 /* vùng chạm dễ bấm hơn */
    .ti-table { font-size: .8rem; }
    .ti-table th, .ti-table td { padding: 7px 9px; }
    .ti-band h2 { font-size: 1rem; }
}

/* =========================================================================
 *  Tra cứu địa giới hành chính
 * ====================================================================== */
.ti-dg .ti-h3 { margin-top: 0; }
.ti-dg input[type=search] { width: 100%; }

.dg-result { padding: 22px 24px; }
.dg-label { margin: 0 0 4px; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--rbnd-muted); }
.dg-old { margin: 0; font-size: 1.05rem; color: #343a40; line-height: 1.5; }
.dg-arrow { display: flex; justify-content: center; margin: 14px 0; color: var(--rbnd-primary); font-size: 1.3rem; }
.dg-new { margin: 0 0 14px; font-size: 1.35rem; font-weight: 800; color: var(--rbnd-primary); line-height: 1.35; }
.dg-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dg-note { margin: 14px 0 0; font-size: .85rem; line-height: 1.5; color: #495057; }
.dg-note i { margin-right: 4px; color: var(--rbnd-muted); }

/* Xã/phường cũ bị tách: liệt kê đủ các đích, đích chính có nhãn chữ (không chỉ dựa vào màu) */
.dg-targets { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.dg-targets li {
    border: 1px solid var(--rbnd-border); border-radius: 10px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.dg-targets li.is-default { border-color: var(--rbnd-primary); background: #f0f8f4; }
.dg-targets strong { font-size: 1.05rem; }
.dg-badge {
    align-self: flex-start; background: var(--rbnd-primary); color: #fff;
    font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 2px 10px;
}
.dg-target-actions { display: flex; gap: 16px; font-size: .88rem; }
.dg-target-actions a { color: var(--rbnd-primary); font-weight: 600; }

.dg-list { list-style: none; margin: 0; padding: 0; }
.dg-list li + li { border-top: 1px solid #eef0f2; }
.dg-list a {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center;
    padding: 11px 4px; text-decoration: none; color: inherit;
}
.dg-list a:hover { background: #f6f8f7; }
.dg-list a span { grid-column: 1; font-size: .85rem; color: var(--rbnd-muted); }
.dg-list a i { grid-column: 2; grid-row: 1 / span 2; color: var(--rbnd-primary); }

.dg-empty ol { padding-left: 1.2rem; margin-bottom: 12px; }
.dg-empty li { margin-bottom: 6px; line-height: 1.55; }

@media (max-width: 991.98px) {
    .dg-result { padding: 16px 14px; }
    .dg-new { font-size: 1.2rem; }
    .dg-actions .btn { width: 100%; }
    .dg-list a { padding: 13px 4px; }
}
