/* Bố cục riêng Auto Data, dùng token Partner và kit dùng chung. */
.ad-page { min-width: 0; display: flex; flex-direction: column; gap: var(--ap-gap); }
.ad-page h2, .ad-page h3 { margin: 0 0 var(--ap-space-2); font-weight: 600; }
.ad-page h2 { font-size: var(--fs-xl); }
.ad-page h3 { font-size: var(--fs-lg); }
.ad-page .ui-card { padding: var(--ap-card-pad); border-radius: var(--ap-r-lg); min-width: 0; margin: 0; }
.ad-page > *, .ad-panel > *, .ad-grid2 > *, .ad-grid3 > * { margin-block: 0; }
.ad-panel { display: flex; flex-direction: column; gap: var(--ap-gap); }
.ad-page [hidden] { display: none !important; }
.ad-status, .ad-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ap-gap); }
.ad-status > div { min-width: 0; padding-right: var(--ap-space-3); border-right: 1px solid var(--ui-line); }
.ad-status > div:last-child { border: 0; }
.ad-label { display: block; font-size: var(--fs-2xs); font-weight: 700; color: var(--ui-muted); margin-bottom: var(--ap-space-2); }
.ad-grid2, .ad-grid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ap-gap); }
.ad-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-flow { margin-top: var(--ap-gap); counter-reset: flow; align-items: stretch; }
.ad-node { padding: var(--ap-space-3); border: 1px solid var(--ui-line); border-radius: var(--ap-r); background: var(--ui-surface-2); min-width: 0; }
.ad-node b, .ad-node span { display: block; }
.ad-node span { font-size: var(--fs-xs); color: var(--ui-muted); margin-top: var(--ap-space-2); }
.ad-arrow { display: none; }
.ad-row, .ad-page .ap-actions { display: flex; gap: var(--ap-space-2); align-items: center; flex-wrap: wrap; }
.ad-row { justify-content: space-between; }
.ad-page .ap-actions { margin-top: var(--ap-space-3); }
.ad-page .ap-title .ap-actions { margin-top: 0; }
.ad-tabs { flex-wrap: nowrap; }
.ad-page .ui-btn, .ad-page .ui-input, .ad-tabs .ui-tab { box-sizing: border-box; min-height: 0; height: var(--ap-control-h); padding-block: 0; border-radius: var(--ap-r); font-size: var(--fs-base); }
.ad-page .ui-btn-sm { height: var(--ap-control-sm-h); padding-inline: var(--ap-space-2); }
.ad-page .ui-btn { gap: var(--ap-space-2); }
.ad-page .ui-btn:not(.ui-btn-sm) { padding-inline: var(--ap-space-3); }
.ad-field { display: flex; flex-direction: column; gap: var(--ap-space-2); min-width: 0; }
.ad-field label { font-size: var(--fs-base); font-weight: 600; }
.ad-field select { width: 100%; }
.ad-price { font-size: var(--fs-xl); font-weight: 700; margin-top: var(--ap-space-3); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ad-kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--ap-space-2); font-size: var(--fs-sm); }
.ad-kv dt { color: var(--ui-muted); }
.ad-kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.ad-qrow { display: flex; justify-content: space-between; gap: var(--ap-space-3); font-size: var(--fs-sm); margin-top: var(--ap-space-2); }
.ad-qrow b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.ad-qtotal { border-top: 1px solid var(--ui-line); padding-top: var(--ap-space-2); font-size: var(--fs-base); }
#adQuote, #adErr { margin-top: var(--ap-space-3); }
.ad-steps { list-style: none; margin: var(--ap-space-4) 0 0; padding: 0; display: grid; gap: var(--ap-space-6); }
.ad-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--ap-space-3); }
.ad-number { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--ui-line); border-radius: 50%; font-size: var(--fs-sm); font-weight: 700; }
.ad-step.done .ad-number { color: var(--ui-ok); border-color: var(--ui-ok); }
.ad-step.now .ad-number { color: var(--brand-primary); border-color: var(--brand-primary); }
.ad-consent { border: 1px solid var(--ui-line); border-radius: var(--ap-r); padding: var(--ap-space-3); max-height: 300px; overflow: auto; font-size: var(--fs-sm); }
.ad-consent ol { padding-left: var(--ap-space-6); }
.ad-page li + li { margin-top: var(--ap-space-2); }
.ad-page details { padding: var(--ap-space-3) 0; border-bottom: 1px solid var(--ui-line); font-size: var(--fs-sm); }
.ad-page summary { cursor: pointer; font-weight: 600; }
.ad-page .ui-table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; margin-top: var(--ap-space-3); }
.ad-page .ui-table th, .ad-page .ui-table td { padding: var(--ap-table-py) var(--ap-table-px); font-size: var(--fs-sm); }
.ad-connection-actions { display: flex; gap: var(--ap-space-2); flex-wrap: wrap; min-width: 180px; }
.ad-page .lead { font-size: var(--fs-base); color: var(--ui-muted); }
.ad-page .ex, .ad-page .time { font-size: var(--fs-xs); color: var(--ui-muted); }
@media (max-width: 768px) {
    .ad-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ad-status > div { border: 0; }
    .ad-grid2, .ad-grid3, .ad-flow { grid-template-columns: minmax(0, 1fr); }
    .ad-page .ui-btn-sm { height: var(--ap-control-sm-h); }
    .ad-page .ad-counting-table { table-layout: fixed; white-space: normal; }
    .ad-counting-table th, .ad-counting-table td, .ad-counting-table .ui-badge { white-space: normal; overflow-wrap: anywhere; }
    .ad-counting-table th:first-child { width: 57%; }
    #connBox .ui-table-scroll { scrollbar-width: auto; }
    #connBox .ui-table-scroll::-webkit-scrollbar { height: 8px; }
    #connBox .ui-table-scroll::-webkit-scrollbar-thumb { background: var(--ui-muted); border-radius: var(--ap-r-sm); }
    .ad-page .ap-title { align-items: flex-start; flex-direction: column; gap: var(--ap-space-3); }
    .ad-tabs .ui-tab { flex: 0 0 auto; white-space: nowrap; }
}

.ad-page > .ui-tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
.ad-page > .ui-tabs a.ui-tab { text-decoration: none; }
.ad-step.done .ad-number { background: var(--ui-ok-bg); }
.ad-node { position: relative; counter-increment: flow; }
.ad-node::before { content: '0' counter(flow); display: block; color: var(--brand-primary); font-size: var(--fs-xs); font-weight: 700; margin-bottom: var(--ap-space-2); }
.ad-node:not(:last-child)::after { content: '→'; position: absolute; right: calc(-1 * var(--ap-gap)); width: var(--ap-gap); text-align: center; top: 45%; color: var(--ui-muted); }
@media (max-width: 768px) {
    .ad-node:not(:last-child)::after { content: '↓'; right: auto; left: calc(50% - var(--ap-gap) / 2); top: 100%; height: var(--ap-gap); display: grid; place-items: center; }
}

.ad-plan > .ui-btn { align-self: flex-start; width: auto; max-width: 100%; }
.ad-plan-status { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--ap-space-2); align-self: flex-start; }
.ad-setup-plan, .ad-shop-links { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: var(--ap-space-2); }
.ad-setup-plan + .ad-setup-plan { margin-top: var(--ap-space-2); }
.ad-shop-links { margin-top: var(--ap-space-3); font-size: var(--fs-sm); }
.ad-page .ticks { list-style: none; padding: 0; margin-block: var(--ap-space-3) 0; font-size: var(--fs-sm); }
.ad-page .ticks li { position: relative; padding-left: var(--ap-space-4); }
.ad-page .ticks li::before { content: ''; position: absolute; left: 0; top: .35em; width: 6px; height: 10px; border: solid var(--ui-ok); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ad-page .ticks.no li::before { top: .7em; width: 8px; height: 0; border: 0; border-top: 2px solid var(--ui-muted); transform: none; }
.ad-step-actions { margin-top: var(--ap-space-3); display: flex; gap: var(--ap-space-2); flex-wrap: wrap; }
@media (max-width: 768px) { .ad-counting-table .ui-badge { border-radius: var(--ap-r-sm); } }
.ad-sheet-tabs { margin: var(--ap-space-3) 0 var(--ap-space-2); }
.ad-cols { margin-top: var(--ap-space-3); border: 1px solid var(--ui-line); border-radius: var(--ap-r); padding: 0 var(--ap-space-3); }
.ad-cols summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: var(--fs-sm); }
.ad-cols .ui-table-scroll { margin-bottom: var(--ap-space-3); }
.ad-cols td.wrap-cell { white-space: normal; min-width: 240px; }
.ad-sheet-sample th, .ad-sheet-sample td { white-space: nowrap; }
.ad-sheet-sample th { cursor: help; }
.ad-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--ap-space-3); margin: var(--ap-space-3) 0; }
.ad-kpi { display: flex; flex-direction: column; gap: var(--ap-space-1); padding: var(--ap-space-3); border: 1px solid var(--ui-line); border-radius: var(--ap-r); }
.ad-kpi b { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-bar { height: 8px; border-radius: 999px; background: var(--ui-line-soft, var(--ui-line)); overflow: hidden; margin: var(--ap-space-2) 0; }
.ad-bar i { display: block; height: 100%; background: var(--brand-primary); }
.ad-bar.warn i { background: var(--ui-warn); }
.ad-bar-sm { height: 6px; margin: 0; min-width: 80px; }
.ad-bar-cell { width: 40%; }

/* Phân cấp nội dung và vùng tác nghiệp Auto Data. */
.ad-page { line-height: 1.6; }
.ad-page p { margin: var(--ap-space-2) 0; max-width: 70ch; }
.ad-page h1 { font-size: var(--fs-xl); line-height: 1.35; }
.ad-page .ui-note { color: var(--ui-muted); }
.ad-hero { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.5fr); gap: var(--ap-gap); align-items: start; }
.ad-hero .ad-flow { margin: 0; }
.ad-benefits .ui-card { border-top: 2px solid var(--brand-primary); }
.ad-page .ad-intro h2 { margin-bottom: var(--ap-space-2); }
.ad-status-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-status-overview > div:last-child { border-right: 0; }
.ad-tabs { gap: var(--ap-space-2); padding: var(--ap-space-2); border: 1px solid var(--ui-line); border-radius: var(--ap-r-lg); background: var(--ui-surface-2); }
.ad-tabs .ui-tab { flex: 1 0 auto; justify-content: center; white-space: nowrap; height: auto; min-height: var(--ap-control-h); }
.ad-page .ad-plan { display: flex; flex-direction: column; align-items: stretch; gap: var(--ap-space-2); }
.ad-plan .ad-price { margin-top: var(--ap-space-2); }
.ad-plan .ad-kv { margin-block: var(--ap-space-2); flex: 1; align-content: start; }
.ad-plan .ui-btn + .ui-btn { margin-top: 0; }
.ad-quota { display: block; width: 100%; height: 8px; border: 0; border-radius: var(--ap-r-sm); overflow: hidden; background: var(--ui-line); accent-color: var(--brand-primary); }
.ad-quota::-webkit-progress-bar { background: var(--ui-line); }
.ad-quota::-webkit-progress-value { background: var(--brand-primary); }
.ad-quota::-moz-progress-bar { background: var(--brand-primary); }
.ad-policy { display: flex; align-items: flex-start; gap: var(--ap-space-2); margin-top: var(--ap-space-4); }
.ad-policy input { flex-shrink: 0; margin-top: var(--ap-space-1); }
.ad-timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ap-gap); }
.ad-page .ad-timeline > li { margin: 0; }
.ad-timeline .ad-step { grid-template-columns: minmax(0, 1fr); align-content: start; border-top: 1px solid var(--ui-line); padding-top: var(--ap-space-3); }
.ad-number { border-radius: var(--ap-r); background: var(--ui-surface-2); }
.ad-workbook .ad-row { border-bottom: 1px solid var(--ui-line); padding-bottom: var(--ap-space-3); }
.ad-workbook .ad-sheet-tabs { border: 1px solid var(--ui-line); border-radius: var(--ap-r); padding: var(--ap-space-1); gap: var(--ap-space-1); flex-wrap: nowrap; overflow-x: auto; }
.ad-workbook .ui-table-scroll { border: 1px solid var(--ui-line); border-radius: var(--ap-r); }
.ad-workbook .ad-sheet-sample th { background: var(--ui-surface-2); font-family: var(--font-mono); font-size: var(--fs-xs); }
.ad-workbook .ad-sheet-sample td, .ad-workbook .ad-sheet-sample th { border-right: 1px solid var(--ui-line); }
.ad-page .ad-kpi { background: var(--ui-surface-2); min-width: 0; }
.ad-kpi b { overflow-wrap: anywhere; }
.ad-wizard-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .45fr); gap: var(--ap-gap); align-items: start; }
.ad-wizard-panels { display: grid; gap: var(--ap-gap); min-width: 0; }
.ad-wizard .ad-summary { position: sticky; top: var(--ap-space-4); }
.ad-wizard .ap-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ap-space-2); margin: 0; }
.ad-wizard .ap-step { border: 1px solid var(--ui-line); border-radius: var(--ap-r); padding: var(--ap-space-3); gap: var(--ap-space-2); min-width: 0; }
.ad-wizard .ap-step.on { border-color: var(--brand-primary); background: var(--ui-surface-2); color: var(--ui-text); }
.ad-wizard .ap-step .n { border-radius: var(--ap-r-sm); flex-shrink: 0; }
.ad-wizard .ap-choice { grid-template-columns: minmax(0, 1fr); gap: var(--ap-space-2); }
.ad-wizard .ap-choice > label { padding: var(--ap-space-3); border-radius: var(--ap-r); min-width: 0; }
.ad-wizard .ap-choice > label > div { min-width: 0; overflow-wrap: anywhere; }
.ad-wizard .ui-form-row { gap: var(--ap-space-3); margin-top: var(--ap-space-4); }
.ad-wizard .ui-form-group { min-width: 0; }
.ad-wizard .ui-form-actions { display: flex; gap: var(--ap-space-2); flex-wrap: wrap; margin-top: var(--ap-space-4); }
.ad-wizard .ap-kv { grid-template-columns: minmax(0, 1fr); gap: var(--ap-space-1); }
.ad-wizard .ap-kv .v { margin-bottom: var(--ap-space-3); overflow-wrap: anywhere; }
.ad-page .ui-table-scroll:focus-visible, .ad-page summary:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
@media (max-width: 768px) {
    .ad-hero, .ad-wizard-layout { grid-template-columns: minmax(0, 1fr); }
    .ad-wizard .ad-summary { position: static; }
    .ad-timeline { grid-template-columns: minmax(0, 1fr); }
    .ad-timeline .ad-step { grid-template-columns: 32px minmax(0, 1fr); }
    .ad-status-overview { grid-template-columns: minmax(0, 1fr); gap: var(--ap-space-3); }
    .ad-status-overview > div { padding: 0 0 var(--ap-space-3); border-bottom: 1px solid var(--ui-line); }
    .ad-status-overview > div:last-child { padding-bottom: 0; border-bottom: 0; }
    .ad-wizard .ap-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ad-wizard .ap-step { font-size: var(--fs-sm); }
    .ad-workbook .ui-tab { flex: 0 0 auto; white-space: nowrap; height: auto; min-height: var(--ap-control-sm-h); }
    .ad-kpis { grid-template-columns: minmax(0, 1fr); }
    .ad-page .ad-cols summary { padding-block: var(--ap-space-3); }
}

/* Lượt 2: CTA, thẻ giá và hạn mức có cùng nhịp đọc. */
.ad-page .ad-hero-actions { justify-content: flex-start; margin-top: var(--ap-gap); }
.ad-node .time { display: inline-block; padding: var(--ap-space-1) var(--ap-space-2); border: 1px solid var(--ui-line); border-radius: var(--ap-r-sm); line-height: 1.4; }
.ad-pricing > .ad-grid2 { margin-top: var(--ap-gap); }
.ad-pricing .ad-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ap-space-2); font-size: var(--fs-3xl); line-height: 1.25; }
.ad-price-unit { font-size: var(--fs-sm); font-weight: 400; color: var(--ui-muted); }
.ad-pricing .ad-plan-features { flex: 1; margin-bottom: var(--ap-gap); }
.ad-pricing .ad-plan > .ui-btn { width: 100%; margin-top: auto; }
.ad-plan-actions { display: flex; gap: var(--ap-space-2); align-items: center; margin-top: auto; }
.ad-plan-actions .ui-btn { flex: 1 1 0; height: auto; min-height: var(--ap-control-sm-h); white-space: normal; text-align: center; }
.ad-quota-row { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--ap-space-2); margin-bottom: var(--ap-space-2); }
.ad-quota-row .ad-quota { flex: 1; min-width: 0; width: 0; }
.ad-quota-row span { flex-shrink: 0; color: var(--ui-muted); font-size: var(--fs-xs); }
.ad-quota.warn { accent-color: var(--ui-warn); }
.ad-quota.warn::-webkit-progress-value { background: var(--ui-warn); }
.ad-quota.warn::-moz-progress-bar { background: var(--ui-warn); }
.ad-quota.bad { accent-color: var(--ui-bad); }
.ad-quota.bad::-webkit-progress-value { background: var(--ui-bad); }
.ad-quota.bad::-moz-progress-bar { background: var(--ui-bad); }
@media (max-width: 768px) {
    .ad-page .ad-hero-actions { flex-direction: column; align-items: stretch; }
    .ad-hero-actions .ui-btn { width: 100%; }
    .ad-page > .ui-tabs .ui-tab { flex-shrink: 0; white-space: nowrap; }
}

/* Thẻ tóm tắt là lối vào chi tiết, có trạng thái bàn phím rõ ràng. */
.ad-status-link { display: flex; flex-direction: column; align-items: flex-start; gap: var(--ap-space-2); padding: var(--ap-space-3); min-width: 0; border: 1px solid var(--ui-line); border-radius: var(--ap-r); color: var(--ui-text); text-decoration: none; }
.ad-status-link:hover { border-color: var(--brand-primary); background: var(--ui-surface-2); }
.ad-status-link:focus-visible, .ad-page [tabindex="-1"]:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.ad-status-link .ad-label { margin: 0; }
.ad-status-hint { color: var(--brand-primary); font-size: var(--fs-xs); margin-top: auto; }
.ad-page h2, .ad-page h3 { font-size: var(--fs-lg); }
.ad-plan-actions { display: flex; gap: var(--ap-space-2); flex-wrap: wrap; }
#connBox .ui-table { table-layout: fixed; width: 100%; }
#connBox .ui-table td { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#connBox .ap-badge-row { flex-wrap: wrap; min-width: 0; }
#connBox .val-bad { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
#connBox td:last-child { width: 200px; }
#connBox .ad-connection-actions { min-width: 0; }
@media (max-width: 1100px) {
    /* Giữ đủ nhãn, dữ liệu và nút khi bảng không còn vừa chiều ngang. */
    #connBox .ui-table-scroll { overflow: visible; }
    #connBox .ui-table, #connBox tbody { display: block; width: 100%; min-width: 0; }
    #connBox thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    #connBox tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--ui-line); border-radius: var(--ap-r); padding: var(--ap-space-2); margin-bottom: var(--ap-space-3); }
    #connBox .ui-table td { display: block; position: static; width: auto; min-width: 0; max-width: none; border: 0; box-shadow: none; }
    #connBox td::before { content: attr(data-label); display: block; font-size: var(--fs-2xs); font-weight: 700; color: var(--ui-muted); margin-bottom: var(--ap-space-2); }
    #connBox td:nth-last-child(2), #connBox td:last-child { grid-column: 1 / -1; }
    #connBox .ad-connection-actions { width: 100%; }
}
@media (max-width: 768px) {
    .ad-status-overview { grid-template-columns: minmax(0, 1fr); }
    .ad-page h1 { font-size: var(--fs-lg); }
    .ad-status-link { min-height: var(--ap-control-h); }
}
@media (max-width: 480px) {
    #connBox tr { grid-template-columns: minmax(0, 1fr); }
}
