/* Lá số tử vi: the chart square, the summary and the twelve palaces.
   Loaded after nhanso-ngay-tot.css, whose tokens (--nt-*) it uses. */

.nhanso-ls-page {
    --ls-major: #8f1d1d;
    --ls-cat: #1f6a3a;
    --ls-sat: #5b4a3c;
    --ls-now: #fff7e2;
}

.nhanso-ls-form .nhanso-cx-form__foot {
    justify-content: flex-start;
}

.nhanso-ls-form .nhanso-nt-btn {
    margin-left: auto;
}

/* --- The chart ------------------------------------------------------------ */
.nhanso-ls-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto 8px;
    padding: 0 20px;
}

.nhanso-ls-chart {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(190px, auto);
    gap: 0;
    background: #fff;
    border: 2px solid var(--nt-night);
    border-radius: 6px;
    overflow: hidden;
}

.nhanso-ls-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 8px 9px 6px;
    font-size: 13px;
    line-height: 1.3;
    border: 1px solid var(--nt-line);
}

.nhanso-ls-cell.is-menh {
    background: #fdf3f1;
    box-shadow: inset 0 0 0 2px var(--ls-major);
}

.nhanso-ls-cell.is-now:not(.is-menh) {
    background: var(--ls-now);
}

.nhanso-ls-cell__head {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.nhanso-ls-cell__head b {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--nt-night);
}

.nhanso-ls-cell__head em {
    margin-left: auto;
    font-style: normal;
    font-weight: 800;
    color: var(--nt-g2);
}

.nhanso-ls-than {
    padding: 0 5px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: var(--ls-major);
    border-radius: 3px;
}

.nhanso-ls-major,
.nhanso-ls-minor ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nhanso-ls-major li {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--ls-major);
}

.nhanso-ls-major li.is-empty {
    font-size: 12.5px;
    font-weight: 600;
    font-style: italic;
    color: var(--nt-muted);
}

.nhanso-ls-minor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 6px;
    font-size: 12px;
}

.nhanso-ls-minor .is-cat li {
    color: var(--ls-cat);
}

.nhanso-ls-minor .is-sat li {
    color: var(--ls-sat);
}

.nhanso-ls-bright {
    font-size: 11px;
    font-weight: 800;
    color: var(--nt-g2);
}

.nhanso-ls-bright.is-dim {
    color: var(--nt-muted);
}

.nhanso-ls-ring {
    margin: 2px 0 0;
    font-size: 11px;
    font-style: italic;
    color: var(--nt-muted);
}

.nhanso-ls-flow {
    margin: 1px 0 0;
    font-size: 11px;
    font-weight: 700;
    color: #6b3fa0;
}

.nhanso-ls-han {
    padding: 0 5px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: #6b3fa0;
    border-radius: 3px;
}

.nhanso-tvn-days.nhanso-ls-years ul {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nhanso-ls-notes {
    display: grid;
    gap: 8px;
    margin: 14px 0 18px;
    padding: 0;
    list-style: none;
}

.nhanso-ls-notes li {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--nt-line);
    border-left: 4px solid var(--nt-g1);
    border-radius: 8px;
}

.nhanso-ls-notes li.is-hop { border-left-color: var(--nt-g3); }
.nhanso-ls-notes li.is-ky { border-left-color: var(--nt-bad); }

.nhanso-ls-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 18px;
    padding: 0;
    list-style: none;
}

.nhanso-ls-months li {
    padding: 10px 12px;
    font-size: 14.5px;
    background: #fff;
    border: 1px solid var(--nt-line);
    border-top: 3px solid var(--nt-g1);
    border-radius: 8px;
}

.nhanso-ls-months li.is-hop { border-top-color: var(--nt-g3); }
.nhanso-ls-months li.is-ky { border-top-color: var(--nt-bad); }

.nhanso-ls-months p {
    margin: 4px 0 0;
}

.nhanso-ls-months__head {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    align-items: baseline;
    margin-top: 0 !important;
}

.nhanso-ls-months__head span {
    font-size: 12.5px;
    color: var(--nt-muted);
}

.nhanso-ls-key {
    margin: 8px 0 0;
    font-size: 12px;
    color: #aab3c5;
}

.nhanso-ls-hoa {
    display: inline-block;
    padding: 0 4px;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 800;
    color: #fff;
    vertical-align: 1px;
    border-radius: 3px;
}

.nhanso-ls-hoa.is-loc { background: #1f7a3a; }
.nhanso-ls-hoa.is-quyen { background: #8a4b12; }
.nhanso-ls-hoa.is-khoa { background: #2f6f9f; }
.nhanso-ls-hoa.is-ky { background: #3d4852; }

.nhanso-ls-cell__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 4px;
    font-size: 11.5px;
    color: var(--nt-muted);
    border-top: 1px dashed var(--nt-line);
}

.nhanso-ls-mark {
    padding: 0 4px;
    font-weight: 800;
    color: #fff;
    background: var(--nt-night);
    border-radius: 3px;
}

.nhanso-ls-center {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    padding: 16px 18px;
    color: #e8ecf5;
    background: linear-gradient(160deg, var(--nt-night), var(--nt-night-2));
}

.nhanso-ls-center__title {
    margin: 0 0 10px;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
    color: var(--nt-gold-light);
}

.nhanso-ls-center dl {
    display: grid;
    gap: 5px;
    margin: 0;
}

.nhanso-ls-center dl div {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    font-size: 14px;
}

.nhanso-ls-center dt {
    color: #aab3c5;
}

.nhanso-ls-center dd {
    margin: 0;
    font-weight: 700;
    color: #fff;
}

.nhanso-ls-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 12px 0 0;
    font-size: 12px;
}

.nhanso-ls-legend span::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    border-radius: 2px;
}

.nhanso-ls-legend .is-chinh::before { background: #e06b6b; }
.nhanso-ls-legend .is-cat::before { background: #5fbf7f; }
.nhanso-ls-legend .is-sat::before { background: #b9a48f; }
.nhanso-ls-legend .is-num::before { background: #7fb2dd; }

/* --- Summary and palace list ---------------------------------------------- */
.nhanso-ls-star {
    margin: 0 0 14px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--nt-line);
    border-left: 4px solid var(--ls-major);
    border-radius: 8px;
}

.nhanso-ls-star.is-dim {
    border-left-color: var(--nt-muted);
}

.nhanso-ls-star p {
    margin: 6px 0 0;
}

.nhanso-ls-star__head {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    align-items: baseline;
    margin-top: 0 !important;
}

.nhanso-ls-star__head b {
    font-size: 17px;
    color: var(--ls-major);
}

.nhanso-ls-palaces__head b a,
.nhanso-ls-star__head b a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.nhanso-ls-star__head span {
    font-size: 13px;
    font-weight: 700;
    color: var(--nt-g2);
}

.nhanso-ls-star.is-dim .nhanso-ls-star__head span {
    color: var(--nt-muted);
}

.nhanso-ls-facts {
    margin-top: 16px;
}

.nhanso-ls-facts dd {
    font-weight: 500;
    color: var(--nt-text);
}

.nhanso-ls-around li {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 16px;
}

.nhanso-ls-around b {
    color: var(--nt-ink);
}

.nhanso-ls-around span {
    color: var(--nt-text);
}

.nhanso-ls-palaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nhanso-ls-palaces li {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--nt-line);
    border-radius: 10px;
}

.nhanso-ls-palaces p {
    margin: 4px 0 0;
    font-size: 14.5px;
}

.nhanso-ls-palaces__head {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    align-items: baseline;
}

.nhanso-ls-palaces__head b {
    font-size: 16.5px;
    color: var(--nt-night);
}

.nhanso-ls-palaces__head span {
    font-size: 13px;
    color: var(--nt-muted);
}

.nhanso-ls-palaces__read {
    margin-top: 8px !important;
    padding-left: 10px;
    border-left: 3px solid var(--ls-major);
}

.nhanso-ls-palaces__read.is-dim {
    border-left-color: var(--nt-muted);
}

.nhanso-ls-palaces .is-cat b { color: var(--ls-cat); }
.nhanso-ls-palaces .is-sat b { color: var(--ls-sat); }

.nhanso-ls-star-table em {
    font-style: normal;
    font-weight: 800;
    color: var(--nt-g2);
}

.nhanso-ls-star-table li.is-dim em {
    color: var(--nt-muted);
}

/* Links inside a text row stay inline: .nhanso-nt-rows a is a whole-row
   block link elsewhere. */
.nhanso-nt-rows.nhanso-ls-around a {
    display: inline;
    min-height: 0;
    padding: 0;
    font-weight: 700;
    color: var(--nt-g2);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nhanso-ls-cta {
    margin-top: 14px;
}

#chinh-tinh .nhanso-nt-h3 a {
    color: var(--ls-major);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.nhanso-ls-cta .nhanso-nt-btn {
    display: inline-flex;
    align-items: center;
    height: auto;
    min-height: 44px;
    padding: 10px 18px;
    line-height: 1.3;
    text-decoration: none;
}

.nhanso-ls-steps {
    margin: 0;
    padding-left: 22px;
}

.nhanso-ls-steps li + li {
    margin-top: 8px;
}

/* --- Narrow screens: the square shrinks, the palace list carries the detail */
@media (max-width: 767px) {
    .nhanso-ls-wrap {
        padding: 0 8px;
    }

    .nhanso-ls-chart {
        grid-auto-rows: minmax(150px, auto);
    }

    .nhanso-ls-cell {
        gap: 2px;
        padding: 5px 5px 4px 6px;
        font-size: 10.5px;
    }

    .nhanso-ls-mark {
        padding: 0 3px;
        font-size: 8.5px;
    }

    .nhanso-ls-cell__head {
        flex-wrap: wrap;
        gap: 2px 4px;
    }

    .nhanso-ls-cell__head b {
        font-size: 10px;
        letter-spacing: 0;
    }

    .nhanso-ls-than {
        font-size: 9px;
        padding: 0 3px;
    }

    .nhanso-ls-major li {
        font-size: 11.5px;
    }

    .nhanso-ls-major li.is-empty {
        font-size: 10px;
    }

    .nhanso-ls-minor {
        grid-template-columns: minmax(0, 1fr);
        font-size: 9.5px;
    }

    .nhanso-ls-hoa {
        padding: 0 2px;
        font-size: 8.5px;
    }

    .nhanso-ls-cell__foot {
        font-size: 9px;
    }

    .nhanso-ls-bright {
        font-size: 9px;
    }

    .nhanso-ls-ring,
    .nhanso-ls-flow {
        font-size: 8.5px;
    }

    .nhanso-ls-han {
        padding: 0 3px;
        font-size: 9px;
    }

    .nhanso-ls-key {
        font-size: 9px;
    }

    .nhanso-ls-center {
        padding: 10px 8px;
    }

    .nhanso-ls-center__title {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .nhanso-ls-center dl div {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        font-size: 11px;
    }

    .nhanso-ls-center dt {
        font-size: 9.5px;
    }

    .nhanso-ls-legend {
        display: none;
    }

    .nhanso-ls-palaces,
    .nhanso-ls-months {
        grid-template-columns: minmax(0, 1fr);
    }

    .nhanso-ls-around li {
        grid-template-columns: 92px minmax(0, 1fr);
    }
}

@media (max-width: 575px) {
    .nhanso-ls-form .nhanso-nt-btn {
        width: 100%;
        margin-left: 0;
    }
}
