/* ==========================================================================
   HUYỀN HỌC SỐ — KHU VỰC THÀNH VIÊN (NAVY & WARM CREAM SCHOLARLY THEME)
   ========================================================================== */

:root {
    --navy-900: #08203a;
    --navy-800: #0b2a4a;
    --navy-700: #133c68;
    --cream-bg: #f3f6fa;
    --sand-header: #d8ecf9;
    --sand-soft: #f0f7fd;
    --card-bg: #ffffff;
    --border-warm: #c5d9e8;
    --border-subtle: #e2edf5;
    --gold-eyebrow: #12588d;
    --gold-accent: #1565a8;
    --ink-primary: #0f172a;
    --ink-secondary: #3b4f63;
    --ink-muted: #5f7488;
    --danger-text: #c2181e;
    --danger-bg: #fef2f2;
    --success-text: #0f7228;
    --success-bg: #ecfdf3;
    --amber-text: #8a4f10;
    --amber-bg: #fef9e7;
    --font-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-sans: 'Inter', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-chart: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--cream-bg);
    color: var(--ink-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- TOPBAR ---------- */
.portal-topbar {
    background-color: var(--navy-800);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 12px rgba(8, 32, 58, 0.16);
}

.portal-topbar-inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 20px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.portal-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.portal-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.portal-brand-title {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #ffffff;
}

.portal-brand-sub {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: #a7bcd4;
    margin-top: 3px;
}

.portal-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--navy-800);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.portal-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-user-role {
    font-size: 0.72rem;
    color: #a7bcd4;
}

.btn-topbar-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-topbar-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
}

.btn-mobile-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: #ffffff;
    cursor: pointer;
}

/* ---------- MAIN SHELL ---------- */
.portal-shell {
    max-width: 1220px;
    margin: 0 auto;
    padding: 28px 20px 56px;
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ---------- SIDEBAR ---------- */
.portal-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border-warm);
    border-radius: 6px;
    padding: 16px 12px;
    position: sticky;
    top: 86px;
    box-shadow: 0 1px 6px rgba(15, 52, 86, 0.05);
}

.sidebar-section-label {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gold-eyebrow);
    text-transform: uppercase;
    padding: 4px 10px 9px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 6px;
    font-size: 0.89rem;
    font-weight: 500;
    color: var(--ink-primary);
    transition: background 0.14s ease, color 0.14s ease;
}

.sidebar-link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.82;
}

.sidebar-link:hover {
    background: var(--sand-soft);
    color: var(--navy-800);
}

.sidebar-link.is-active {
    background: var(--navy-800);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-link.is-active svg {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e1effa;
    color: #0e4a77;
}

.sidebar-link.is-active .sidebar-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 12px 4px;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.sidebar-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #c5d9e8;
    background: #ffffff;
    color: var(--navy-800);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.sidebar-btn:hover {
    background: var(--sand-soft);
    border-color: #9ec0da;
}

.sidebar-btn.is-danger {
    color: var(--danger-text);
}

.sidebar-btn.is-danger:hover {
    background: var(--danger-bg);
    border-color: #f3c4be;
}

/* ---------- MAIN CONTENT CARD ---------- */
.portal-card {
    background: var(--card-bg);
    border: 1px solid var(--border-warm);
    border-radius: 6px;
    padding: 24px 28px;
    box-shadow: 0 2px 8px rgba(15, 52, 86, 0.05);
}

.page-eyebrow {
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-eyebrow);
    margin-bottom: 4px;
}

.page-title {
    font-family: var(--font-chart);
    font-size: 1.48rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #0b365c;
    margin: 0 0 6px;
    line-height: 1.25;
}

.page-desc {
    color: var(--ink-secondary);
    font-size: 0.88rem;
    margin: 0 0 16px;
    line-height: 1.5;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header-row > div:first-child {
    flex: 1 1 360px;
    min-width: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding-top: 2px;
}

/* ---------- BUTTONS & INPUTS ---------- */
.btn-navy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    min-height: 40px;
    border-radius: 6px;
    border: 1px solid var(--navy-800);
    background: var(--navy-800);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
    white-space: nowrap;
}

.btn-navy:hover {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: #ffffff;
}

.btn-warm-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    min-height: 40px;
    border-radius: 6px;
    border: 1px solid #b5cfe3;
    background: #ffffff;
    color: #0e3b63;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
    white-space: nowrap;
}

.btn-warm-outline:hover {
    background: #edf6fc;
    border-color: #8cb5d4;
}

.btn-sm {
    padding: 6px 12px;
    min-height: 32px;
    font-size: 0.8rem;
    border-radius: 5px;
}

.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 5px;
    border: 1px solid #d4b077;
    background: #fdf6e9;
    color: #7d4e12;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.btn-ai:hover {
    background: #f8ead1;
}

.btn-danger-ghost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--danger-text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger-ghost:hover {
    background: var(--danger-bg);
    border-color: #f3c4be;
}

.form-input, .form-select-warm, .form-textarea-warm {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid #b5cfe3;
    background: #ffffff;
    color: var(--ink-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.form-input, .form-select-warm {
    height: 40px;
}

.form-select-warm {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23155c8d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px 15px;
    cursor: pointer;
}

.form-input::placeholder, .form-textarea-warm::placeholder {
    color: #8296a8;
    font-weight: 400;
}

.form-input:hover, .form-select-warm:hover, .form-textarea-warm:hover {
    border-color: #8cb5d4;
}

.form-input:focus, .form-select-warm:focus, .form-textarea-warm:focus {
    border-color: #0e4c7d;
    box-shadow: 0 0 0 3px rgba(14, 76, 125, 0.12);
}

.form-label-warm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.81rem;
    font-weight: 600;
    color: #1e3448;
    margin-bottom: 6px;
}

.form-label-hint {
    font-size: 0.74rem;
    font-weight: 600;
    color: #12588d;
    background: #e3f1fb;
    padding: 1px 7px;
    border-radius: 3px;
}

/* ---------- STRUCTURED FORM PANELS & SEGMENTED CONTROLS (SYNCED WITH MỆNH BÀN) ---------- */
.portal-form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-panel {
    background: #ffffff;
    border: 1px solid #b8d2e5;
    border-radius: 4px;
    overflow: hidden;
}

.form-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #e3f1fb;
    border-bottom: 1px solid #bdd6e8;
    padding: 8px 14px;
}

.form-panel-title {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0b3f6b;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.form-panel-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 3px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
}

.form-panel-body {
    padding: 16px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.seg-control {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
    height: 40px;
}

.seg-control.is-full {
    display: grid;
    width: 100%;
}

.seg-control.is-sm {
    height: 32px;
    padding: 2px;
}

.seg-option {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.seg-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.seg-option span {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #355068;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
    white-space: nowrap;
}

.seg-control.is-sm .seg-option span {
    font-size: 0.78rem;
    padding: 0 11px;
}

.seg-option input[type="radio"]:checked + span {
    background: #0b2a4a;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(11, 42, 74, 0.22);
}

.seg-option:hover input[type="radio"]:not(:checked) + span {
    background: #dfeef9;
    color: #0b365c;
}

.leap-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 5px;
    border: 1px solid #d7c78a;
    background: #fbf6df;
    color: #744a1d;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.leap-chip input {
    accent-color: #8a4f10;
    width: 15px;
    height: 15px;
    margin: 0;
}

.calendar-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.lunar-hint-note {
    font-size: 0.79rem;
    color: #164f7a;
    background: #f0f7fd;
    border: 1px solid #c9dff0;
    border-radius: 4px;
    padding: 7px 11px;
    display: none;
}

.lunar-hint-note.is-visible {
    display: block;
}

.form-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: #f5f0d8;
    border-top: 1px solid #dcd1a4;
    padding: 9px 16px;
    font-size: 0.82rem;
    color: #2f2818;
}

.form-summary-bar strong {
    color: #0b2a4a;
}

.form-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.form-actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-grid-name {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 14px;
    align-items: end;
}

/* ---------- REGION SELECTOR & OVERSEAS TIMEZONE PANEL ---------- */
.region-seg {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
}

.region-seg.has-five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.region-opt {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.region-opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.region-opt .region-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 6px;
    border-radius: 4px;
    text-align: center;
    color: #2c4760;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
    min-height: 44px;
}

.region-opt .region-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
}

.region-opt .region-sub {
    font-size: 0.69rem;
    font-weight: 500;
    opacity: 0.78;
    margin-top: 1px;
}

.region-opt input[type="radio"]:checked + .region-pill {
    background: #0b2a4a;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(11, 42, 74, 0.22);
}

.region-opt input[type="radio"]:checked + .region-pill .region-sub {
    color: #bfe0fa;
    opacity: 1;
}

.region-opt:hover input[type="radio"]:not(:checked) + .region-pill {
    background: #dfeef9;
    color: #0b365c;
}

.overseas-box {
    display: none;
    background: #f4f9fd;
    border: 1px solid #c3daec;
    border-radius: 4px;
    padding: 12px 14px;
    flex-direction: column;
    gap: 12px;
}

.overseas-box.is-visible {
    display: flex;
}

.overseas-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.overseas-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 12px;
    align-items: end;
}

.overseas-dst-chip {
    min-height: 40px;
    width: 100%;
    justify-content: center;
    white-space: nowrap;
    line-height: 1.3;
    padding: 8px 12px;
}

.overseas-box .form-label-warm {
    white-space: normal;
}

.vn-hist-alert {
    display: none;
    font-size: 0.8rem;
    color: #7c450d;
    background: #fef6df;
    border: 1px solid #e4cb86;
    border-radius: 4px;
    padding: 7px 11px;
    line-height: 1.45;
}

.vn-hist-alert.is-visible {
    display: block;
}

.sum-shift-pill {
    display: inline-block;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 4px;
}

/* ---------- TABLES (SYNCED WITH MỆNH BÀN ICE-BLUE STYLE) ---------- */
.table-wrap {
    border: 1px solid #b5cfe3;
    border-radius: 4px;
    overflow-x: auto;
    background: #ffffff;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.89rem;
}

.portal-table thead th {
    background: #e1f0fa;
    color: #0b3c66;
    font-weight: 700;
    font-size: 0.81rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 1px solid #b5cfe3;
}

.portal-table tbody td {
    padding: 11px 14px;
    border-top: 1px solid #e1edf6;
    vertical-align: middle;
    color: var(--ink-primary);
}

.portal-table tbody tr:hover {
    background: #f5fafe;
}

.portal-table tbody tr.is-current-row {
    background: #f6f1dc;
}

.portal-table tbody tr.is-current-row td:first-child {
    box-shadow: inset 3px 0 0 #0b3f6b;
}

.title-count-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: #e1f0fa;
    color: #0b4675;
    font-size: 0.76rem;
    font-weight: 700;
}

.profiles-table td,
.profiles-table th {
    padding: 11px 12px;
}

.profile-name-line {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.profile-name-link {
    font-weight: 700;
    color: #0b365c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 175px;
}

.profile-name-link:hover {
    color: #1565a8;
    text-decoration: underline;
}

.profile-sub-note {
    font-size: 0.76rem;
    color: var(--ink-muted);
    max-width: 215px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.pillars-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.83rem;
    color: #334155;
    font-weight: 500;
}

.pillars-sep {
    color: #94a3b8;
}

.pillar-day-chip {
    background: #f5f0d8;
    border: 1px solid #dfd4a8;
    color: #0b2a4a;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

/* ---------- BADGES & ALERTS ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill-male { background: #eaf3ff; color: #164f8a; }
.pill-female { background: #fdf0f4; color: #9c2b52; }
.pill-paid { background: var(--success-bg); color: var(--success-text); }
.pill-vip { background: var(--amber-bg); color: var(--amber-text); border: 1px solid #f2d59b; }
.pill-neutral { background: #f2eee6; color: #675b49; }

.alert-warm {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: var(--success-text); border-color: #abefc6; }
.alert-error { background: var(--danger-bg); color: var(--danger-text); border-color: #fecdca; }
.alert-info { background: #f7f2e7; color: #5c4628; border-color: var(--border-warm); }

/* ---------- FILTER BAR & STATS ---------- */
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 280px;
    max-width: 440px;
}

.filter-tabs {
    display: inline-flex;
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
    height: 40px;
    align-items: center;
}

.filter-tab {
    padding: 5px 13px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #355068;
    height: 100%;
    display: inline-flex;
    align-items: center;
}

.filter-tab:hover:not(.is-active) {
    background: #dfeef9;
    color: #0b365c;
}

.filter-tab.is-active {
    background: var(--navy-800);
    color: #ffffff;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: #f4f9fd;
    border: 1px solid #c5d9e8;
    border-radius: 6px;
    padding: 13px 16px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--gold-eyebrow);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: var(--font-chart);
    font-size: 1.48rem;
    font-weight: 700;
    color: var(--navy-800);
    margin-top: 2px;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    background: #f5f9fd;
    border: 1px dashed #b5cfe3;
    border-radius: 6px;
}

.empty-state h3 {
    font-family: var(--font-chart);
    font-size: 1.18rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--navy-800);
}

.empty-state p {
    color: var(--ink-secondary);
    max-width: 460px;
    margin: 0 auto 20px;
}

/* ---------- SOLAR TERMS CONTROLS ---------- */
.current-term-note {
    font-size: 0.9rem;
    color: var(--ink-secondary);
    margin: 0 0 18px;
}

.year-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.year-input {
    width: 112px;
    text-align: center;
    font-weight: 700;
    font-size: 0.98rem;
}

.sub-heading-serif {
    font-family: var(--font-serif);
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--ink-primary);
    margin: 0 0 12px;
}

/* ---------- LUNAR CONVERTER ---------- */
.mode-switch {
    display: inline-flex;
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 18px;
}

.mode-btn {
    padding: 6px 14px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #355068;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.mode-btn:hover:not(.is-active) {
    background: #dfeef9;
    color: #0b365c;
}

.mode-btn.is-active {
    background: var(--navy-800);
    color: #ffffff;
}

.converter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.converter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 168px;
    gap: 12px;
    align-items: end;
}

.converter-submit-col {
    display: flex;
    align-items: flex-end;
}

.result-banner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.result-panel {
    background: #f4f9fd;
    border: 1px solid #c5d9e8;
    border-radius: 6px;
    padding: 18px 20px;
}

.result-panel.is-primary {
    background: var(--navy-800);
    border-color: var(--navy-800);
    color: #ffffff;
}

.result-panel-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.78;
}

.result-panel-date {
    font-family: var(--font-chart);
    font-size: 1.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 5px 0 4px;
}

.canchi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.canchi-card {
    background: #ffffff;
    border: 1px solid #c5d9e8;
    border-radius: 6px;
    padding: 13px 12px;
    text-align: center;
}

.canchi-card-label {
    font-size: 0.72rem;
    color: var(--gold-eyebrow);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.canchi-card-val {
    font-family: var(--font-chart);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--navy-800);
    margin-top: 4px;
}

.canchi-card-sub {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: 2px;
}

/* ---------- PAGINATION ---------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    font-size: 0.86rem;
    color: var(--ink-secondary);
    flex-wrap: wrap;
}

.pagination-links {
    display: flex;
    gap: 6px;
}

/* ---------- MODAL ---------- */
.portal-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 32, 58, 0.55);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.portal-modal-backdrop.is-open {
    display: flex;
}

.portal-modal {
    background: #ffffff;
    border: 1px solid var(--border-warm);
    border-radius: 16px;
    max-width: 440px;
    width: 100%;
    padding: 26px;
    box-shadow: 0 18px 40px rgba(8, 32, 58, 0.28);
}

/* ---------- FORM GRID ---------- */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 920px) {
    .portal-shell {
        grid-template-columns: 1fr;
        padding: 18px 14px 40px;
    }

    .btn-mobile-menu {
        display: inline-flex;
    }

    .portal-user-meta, .topbar-logout-desktop {
        display: none;
    }

    .portal-sidebar {
        display: none;
        position: static;
    }

    .portal-sidebar.is-open {
        display: block;
    }

    .portal-card {
        padding: 22px 18px;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .stat-strip {
        grid-template-columns: 1fr;
    }

    .converter-grid, .converter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .result-banner, .canchi-grid, .form-grid-2, .form-grid-3, .form-grid-name {
        grid-template-columns: 1fr;
    }

    .region-seg, .region-seg.has-five {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ==========================================================================
   MỆNH BÀN TỨ TRỤ — VIVID CONTRAST INTER DATA-PLATE (CRISP & FB 4:5 SAFE)
   ========================================================================== */

.mb-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: var(--font-chart);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: auto;
}

.mb-stack button,
.mb-stack input,
.mb-stack textarea,
.mb-stack select,
.mb-stack table {
    font-family: var(--font-chart);
}

.mb-card {
    background: #ffffff;
    border: 1px solid #b5cfe3;
    border-radius: 4px;
    padding: 16px 18px;
    box-shadow: 0 1px 4px rgba(15, 52, 86, 0.06);
}

.mb-unified-box {
    background: #ffffff;
    border: 1px solid #adc9df;
    border-radius: 4px;
    padding: 15px 18px;
    box-shadow: 0 2px 8px rgba(15, 52, 86, 0.07);
}

.mb-section {
    margin-top: 13px;
}

.mb-section:first-child {
    margin-top: 0;
}

/* ---------- CLEAN COMPACT HEADER + ĐƯƠNG SỐ ---------- */
.mb-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 11px;
}

.mb-title-block {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}

.mb-title-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #b5cfe3;
}

.mb-main-title {
    font-family: var(--font-chart);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #0b3d66;
    margin: 0;
    line-height: 1.2;
}

.mb-main-sub {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: #3f5c75;
    margin-top: 2px;
}

.mb-person-compact {
    background: #eff7fd;
    border: 1px solid #b9d4e8;
    border-radius: 3px;
    padding: 7px 12px;
    flex: 1 1 430px;
    max-width: 565px;
    font-size: 0.76rem;
    line-height: 1.44;
}

.mb-person-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 3px 16px;
}

.mb-person-item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
}

.mb-person-item.is-full {
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: 1px;
}

.mb-person-label {
    color: #3b556b;
    font-weight: 500;
    white-space: nowrap;
}

.mb-person-item strong {
    color: #0f172a;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mb-edit-inline {
    color: #0d5b9c;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-left: 10px;
}

.mb-edit-inline:hover {
    text-decoration: underline;
}

/* ---------- ATTACHED SECTION HEADER STRIP ---------- */
.mb-strip-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: #d8ecf9;
    border: 1px solid #a8c8e0;
    border-bottom: none;
    padding: 5px 12px;
}

.mb-strip-bar.is-center {
    justify-content: center;
}

.mb-strip-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a3f6b;
    margin: 0;
}

.mb-strip-meta {
    font-size: 0.71rem;
    font-weight: 600;
    color: #164f7a;
}

.mb-sec-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.mb-sec-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a3f6b;
    margin: 0;
}

.mb-sec-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 3px;
    background: #d8ecf9;
    color: #0c4878;
    border: 1px solid #a8c8e0;
}

/* ---------- TINH BÀN TABLE (VIVID CONTRAST, CRISP TYPE) ---------- */
.mb-table-scroll {
    overflow-x: auto;
}

.mb-tinhban {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.76rem;
    background: #ffffff;
    border: 1px solid #a8c8e0;
}

.mb-tinhban th,
.mb-tinhban td {
    border-left: 1px solid #bed6e8;
    border-right: 1px solid #bed6e8;
    border-top: 1px solid #d5e5f0;
    border-bottom: 1px solid #d5e5f0;
    padding: 5px 5px;
    vertical-align: middle;
}

.mb-tinhban thead th {
    background: #e8f4fc;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 6px 4px;
    line-height: 1.24;
    border-bottom: 1px solid #a8c8e0;
}

.mb-tinhban thead th .sub {
    display: block;
    font-size: 0.69rem;
    font-weight: 500;
    color: #334e66;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 1px;
}

.mb-tinhban .col-label {
    background: #dceefb !important;
    color: #0c4b7a;
    font-weight: 700;
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    width: 90px;
}

.mb-tinhban .col-day {
    background: #f5f0d8;
}

.mb-tinhban thead th.col-day {
    background: #ebe2bc;
}

.mb-row-chutinh td:not(.col-label) {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 5px 4px;
}

.mb-row-italic td:not(.col-label) {
    font-style: italic;
    font-weight: 500;
    color: #2f4356;
    font-size: 0.73rem;
    padding: 3px 4px;
}

.mb-row-napam td:not(.col-label) {
    font-weight: 500;
    color: #111827;
    font-size: 0.74rem;
    padding: 5px 4px;
}

.mb-gz-big {
    font-family: var(--font-chart);
    font-size: 1.22rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
    padding: 5px 0;
}

.mb-gz-big span {
    display: block;
}

.mb-tangcan-cell {
    font-size: 0.71rem;
    font-weight: 500;
    line-height: 1.38;
    text-align: left;
    padding: 5px 6px !important;
    word-break: break-word;
}

.mb-tangcan-line {
    margin-bottom: 1px;
}

.mb-tangcan-line:last-child {
    margin-bottom: 0;
}

.mb-footnote {
    font-size: 0.66rem;
    font-weight: 500;
    color: #3b4f63;
    text-align: center;
    margin: 5px 0 0;
    line-height: 1.35;
}

/* ---------- ĐẠI VẬN & LƯU NIÊN (CRISP 10-COLUMN GRID) ---------- */
.mb-strip-scroll {
    overflow-x: auto;
}

.mb-grid-10 {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    width: 100%;
    border-top: 1px solid #a8c8e0;
    border-left: 1px solid #a8c8e0;
    background: #ffffff;
}

.mb-tile {
    border: none;
    border-right: 1px solid #bed6e8;
    border-bottom: 1px solid #a8c8e0;
    border-radius: 0;
    background: #ffffff;
    text-align: center;
    cursor: pointer;
    transition: background 0.12s ease;
    padding: 0;
    margin: 0;
    width: 100%;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.mb-tile:hover {
    background: #f0f8fe;
}

.mb-tile.is-selected {
    background: #f5f0d8;
    box-shadow: inset 0 0 0 1px #c4b57c;
}

.mb-tile-head {
    background: #ebf5fc;
    padding: 4px 2px;
    border-bottom: 1px solid #c6dced;
    font-size: 0.71rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.mb-tile.is-selected .mb-tile-head {
    background: #ebe2bc;
    color: #0f172a;
}

.mb-tile-age {
    font-size: 0.66rem;
    font-weight: 500;
    color: #334155;
    margin-left: 2px;
}

.mb-tile-tt {
    font-size: 0.69rem;
    font-weight: 500;
    color: #273444;
    padding: 2px 2px;
    border-bottom: 1px solid #e4eef6;
    line-height: 1.15;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mb-tile-tt.is-bottom {
    border-bottom: none;
    border-top: 1px solid #e4eef6;
    font-weight: 500;
}

.mb-tile-gz {
    font-family: var(--font-chart);
    font-size: 0.98rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
    padding: 6px 1px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mb-tile-gz span {
    display: block;
}

/* ---------- THẦN SÁT 6-COLUMN TABLE (SHARP & CLEAR) ---------- */
.mb-thansat-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.73rem;
    background: #ffffff;
    border: 1px solid #a8c8e0;
}

.mb-thansat-table th,
.mb-thansat-table td {
    border: 1px solid #bed6e8;
    padding: 7px 5px;
    vertical-align: middle;
}

.mb-thansat-table thead th {
    background: #e8f4fc;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 5px 4px;
    line-height: 1.22;
    border-bottom: 1px solid #a8c8e0;
}

.mb-thansat-table thead th .sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: #334e66;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 1px;
}

.mb-thansat-table .col-day {
    background: #f5f0d8;
}

.mb-thansat-table thead th.col-day {
    background: #ebe2bc;
}

.mb-star-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.36;
}

.mb-star-cat {
    color: #0f7228;
    font-weight: 500;
}

.mb-star-hung {
    color: #c2181e;
    font-weight: 500;
}

.mb-legend {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #0f3a5c;
}

.mb-legend-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mb-dot-cat::before {
    content: "●";
    color: #0f7228;
    font-size: 0.68rem;
}

.mb-dot-hung::before {
    content: "●";
    color: #c2181e;
    font-size: 0.68rem;
}

/* ---------- PHỤ TRỢ & VẬN KHÍ (CRISP 4-COL + 3-ROW) ---------- */
.mb-aux-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.mb-aux-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid #a8c8e0;
    border-left: 1px solid #a8c8e0;
    background: #ffffff;
}

.mb-aux-card {
    border-right: 1px solid #bed6e8;
    border-bottom: 1px solid #a8c8e0;
    border-radius: 0;
    background: #ffffff;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.mb-aux-card-head {
    background: #d8ecf9;
    padding: 5px 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #0a3f6b;
    border-bottom: 1px solid #a8c8e0;
}

.mb-aux-card-body {
    padding: 7px 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mb-aux-gz {
    font-family: var(--font-chart);
    font-size: 0.96rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.22;
}

.mb-aux-gz span {
    display: block;
}

.mb-aux-napam {
    font-size: 0.68rem;
    font-weight: 500;
    color: #334155;
    margin-top: 3px;
    line-height: 1.2;
}

.mb-aux-info-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    border: 1px solid #a8c8e0;
    background: #ffffff;
}

.mb-aux-info-table th,
.mb-aux-info-table td {
    border: 1px solid #bed6e8;
    padding: 6px 11px;
    text-align: left;
    vertical-align: middle;
}

.mb-aux-info-table th {
    background: #d8ecf9;
    color: #0a3f6b;
    width: 84px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.mb-aux-info-table td {
    color: #0f172a;
    font-weight: 500;
}

/* ---------- CAPTURE FOOTER STRIP ---------- */
.mb-capture-footer {
    margin-top: 11px;
    background: #e3f1fb;
    border: 1px solid #b5cfe3;
    text-align: center;
    padding: 5px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #0c4878;
    letter-spacing: 0.02em;
}

/* ---------- LƯU NGUYỆT 12-COLUMN COMPACT TABLE (OUTSIDE CAPTURE BOX) ---------- */
.mb-grid-12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    width: 100%;
    border-top: 1px solid #a8c8e0;
    border-left: 1px solid #a8c8e0;
    background: #ffffff;
}

.mb-month-card {
    border-right: 1px solid #bed6e8;
    border-bottom: 1px solid #a8c8e0;
    border-radius: 0;
    background: #ffffff;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.mb-month-head {
    background: #ebf5fc;
    padding: 4px 1px;
    border-bottom: 1px solid #c6dced;
    font-size: 0.68rem;
    font-weight: 700;
    color: #0f172a;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

.mb-month-head span {
    font-size: 0.63rem;
    font-weight: 500;
    color: #334155;
}

.mb-month-card .mb-tile-tt {
    font-size: 0.64rem;
    font-weight: 500;
    height: 22px;
}

.mb-month-card .mb-tile-gz {
    font-size: 0.88rem;
    padding: 6px 1px;
}

/* Ngũ hành colors — rich saturated contrast (zero pale/washed-out text) */
.el-moc  { color: #0e7a26; }
.el-hoa  { color: #c4161c; }
.el-tho  { color: #8a4f10; }
.el-kim  { color: #4e5866; }
.el-thuy { color: #0b5694; }

/* Force crisp desktop proportions inside offscreen html2canvas clone (even from mobile) */
.mb-unified-box.is-exporting {
    width: 960px !important;
    max-width: 960px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.mb-lbl-short,
.mb-strip-mobile-tag,
.mb-aux-mobile-bar {
    display: none;
}

.mb-unified-box.is-exporting .mb-col-van {
    display: table-cell !important;
}

.mb-unified-box.is-exporting .mb-lbl-full,
.mb-unified-box.is-exporting .mb-tc-pct {
    display: inline !important;
}

.mb-unified-box.is-exporting .mb-lbl-short,
.mb-unified-box.is-exporting .mb-strip-mobile-tag,
.mb-unified-box.is-exporting .mb-aux-mobile-bar {
    display: none !important;
}

.mb-unified-box.is-exporting .mb-grid-10 {
    grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
}

.mb-unified-box.is-exporting .mb-aux-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) !important;
}

.mb-unified-box.is-exporting .mb-aux-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* ---------- NOTES & ACTION BAR ---------- */
.mb-notes-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.mb-export-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fffdf7 0%, #f6efe0 100%);
    border: 1px solid #e2cfa4;
    border-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(15, 52, 86, 0.06);
}

.mb-btn-download-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 26px;
    border: 1px solid #9a630a;
    border-radius: 7px;
    background: linear-gradient(135deg, #c88616 0%, #b5720c 55%, #9c5f08 100%);
    color: #ffffff;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(176, 111, 12, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.mb-btn-download-hero:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(176, 111, 12, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mb-btn-download-hero:active:not(:disabled) {
    transform: translateY(0);
}

.mb-btn-download-hero:disabled {
    opacity: 0.72;
    cursor: wait;
}

.mb-export-brand-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.mb-footer-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mb-back-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.mb-back-btn {
    background: #ffffff;
}

.mb-footer-quota {
    margin-bottom: 0 !important;
}

.mb-footer-cta {
    white-space: nowrap;
}

.mb-branding-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fffdf8 0%, #f8f2e4 100%);
    border: 1px solid #e3d1a8;
    border-radius: 8px;
    padding: 15px 18px;
}

.mb-branding-info {
    flex: 1 1 320px;
    min-width: 0;
}

.mb-branding-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fef3c7;
    border: 1px solid #ecd086;
    color: #92400e;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.mb-branding-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: #0b2a4a;
    line-height: 1.35;
    margin-bottom: 4px;
}

.mb-branding-desc {
    margin: 0;
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
}

.mb-branding-btn {
    background: #ffffff;
    border-color: #c8963e;
    color: #0b2a4a;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.mb-branding-btn:hover {
    background: #0b2a4a;
    border-color: #0b2a4a;
    color: #ffffff;
}

.mb-bottom-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 2px;
}

@media (max-width: 920px) {
    .mb-card,
    .mb-unified-box {
        padding: 12px 10px;
    }

    .mb-tinhban,
    .mb-thansat-table {
        min-width: 660px;
    }

    .mb-grid-10 {
        min-width: 680px;
    }

    .mb-grid-12 {
        min-width: 740px;
    }

    .mb-aux-layout {
        grid-template-columns: 1fr;
    }

    .mb-aux-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mb-person-compact {
        max-width: 100%;
    }

    .mb-person-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   LỊCH ÂM & NGÀY TỐT XẤU (TRẠCH NHẬT — SYNCED ICE-BLUE & INTER THEME)
   ========================================================================== */

.cal-page-card {
    background: #ffffff;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(15, 52, 86, 0.05);
    font-family: var(--font-chart);
    font-variant-numeric: tabular-nums;
}

.cal-nav-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cal-nav-arrow {
    height: 36px;
    min-height: 36px;
    padding: 0 11px;
}

.cal-select-sm {
    height: 36px !important;
    padding: 4px 28px 4px 10px !important;
    font-size: 0.84rem !important;
    width: auto !important;
    min-width: 92px;
}

.cal-filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    background: #edf6fc;
    border: 1px solid #c3daec;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.cal-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cal-filter-item label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #0b3f6b;
    white-space: nowrap;
}

.cal-select-filter {
    height: 36px !important;
    padding: 4px 30px 4px 10px !important;
    font-size: 0.83rem !important;
    flex: 1;
    min-width: 0;
}

.cal-best-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: #f8fbfe;
    border: 1px solid #d4e4f0;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 14px;
}

.cal-stats-inline {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: #334155;
    flex-shrink: 0;
}

.cal-stat-dot {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cal-stat-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.cal-stat-dot.is-good::before { background: #15803d; }
.cal-stat-dot.is-mid::before  { background: #d97706; }
.cal-stat-dot.is-bad::before  { background: #dc2626; }

.cal-best-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cal-best-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
}

.cal-best-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #b9d7c2;
    background: #eefaf1;
    color: #0e5a26;
    font-family: inherit;
    font-size: 0.73rem;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.cal-best-chip:hover {
    background: #dcf4e2;
    border-color: #7cc091;
}

.cal-best-chip.is-active {
    background: #0b2a4a;
    border-color: #0b2a4a;
    color: #ffffff;
}

.cal-chip-star {
    font-style: normal;
    font-weight: 700;
    color: #8a4f10;
}

.cal-best-chip.is-active .cal-chip-star {
    color: #fde68a;
}

/* ---------- 2-COLUMN WORKSPACE ---------- */
.cal-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.cal-grid-card {
    background: #ffffff;
    border: 1px solid #a8c8e0;
    border-radius: 4px;
    overflow: hidden;
}

.cal-grid-headbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    background: #d8ecf9;
    border-bottom: 1px solid #a8c8e0;
    padding: 7px 12px;
}

.cal-grid-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0a3f6b;
}

.cal-legend {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #1e3b56;
}

.cal-leg-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.cal-dot.is-good { background: #15803d; }
.cal-dot.is-mid  { background: #d97706; }
.cal-dot.is-bad  { background: #dc2626; }

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #edf6fc;
    border-bottom: 1px solid #bed6e8;
    text-align: center;
    font-size: 0.73rem;
    font-weight: 700;
    color: #0f3d66;
}

.cal-weekdays > div {
    padding: 6px 2px;
    border-right: 1px solid #d5e5f0;
}

.cal-weekdays > div:last-child {
    border-right: none;
}

.cal-weekdays .is-sun {
    color: #c2181e;
}

.cal-grid-body {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #ffffff;
}

.cal-cell {
    position: relative;
    border: none;
    border-right: 1px solid #dce8f2;
    border-bottom: 1px solid #dce8f2;
    background: #ffffff;
    padding: 6px 5px 5px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
    min-width: 0;
}

.cal-cell:nth-child(7n) {
    border-right: none;
}

.cal-cell.is-empty {
    background: #f8fafc;
    cursor: default;
}

.cal-cell:not(.is-empty):hover {
    background: #f0f8fe;
}

.cal-cell.is-today {
    background: #eef6fd;
}

.cal-cell.is-today .cal-solar-num {
    color: #0b5694;
}

.cal-cell.is-selected {
    background: #f5f0d8 !important;
    box-shadow: inset 0 0 0 2px #0b2a4a;
    z-index: 2;
}

.cal-cell-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
}

.cal-solar-num {
    font-size: 0.96rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

.cal-cell.is-sun .cal-solar-num {
    color: #c2181e;
}

.cal-lunar-num {
    font-size: 0.7rem;
    font-weight: 500;
    color: #52677a;
    line-height: 1.15;
    margin-top: 2px;
}

.cal-lunar-num.is-special {
    color: #b42327;
    font-weight: 700;
}

.cal-cell-canchi {
    font-size: 0.62rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.cal-cell-tag {
    font-size: 0.61rem;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
    text-align: center;
}

.cal-cell-tag.is-term    { background: #e0f2fe; color: #0c4a6e; }
.cal-cell-tag.is-holiday { background: #fee2e2; color: #991b1b; }
.cal-cell-tag.is-hop     { background: #dcfce7; color: #166534; }
.cal-cell-tag.is-warn    { background: #fef3c7; color: #92400e; }

/* ---------- RIGHT PANEL: DAY DETAIL INSPECTOR ---------- */
.cal-detail-card {
    background: #ffffff;
    border: 1px solid #a8c8e0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: opacity 0.15s ease;
}

.cal-detail-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0b2a4a;
    color: #ffffff;
    padding: 13px 15px;
}

.cal-detail-weekday {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ec8ea;
}

.cal-detail-solar {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 1px;
}

.cal-detail-lunar {
    font-size: 0.78rem;
    color: #d7e8f7;
    margin-top: 3px;
}

.cal-rating-box {
    text-align: center;
    padding: 7px 11px;
    border-radius: 4px;
    min-width: 102px;
    flex-shrink: 0;
}

.cal-rating-box.is-good { background: #dcfce7; color: #14532d; }
.cal-rating-box.is-mid  { background: #fef3c7; color: #78350f; }
.cal-rating-box.is-bad  { background: #fee2e2; color: #7f1d1d; }

.cal-rating-badge {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cal-rating-score {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 2px;
}

.cal-rating-score span {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.75;
}

.cal-event-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 7px 13px;
    background: #f4f9fd;
    border-bottom: 1px solid #d5e5f0;
}

.cal-event-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
}

.cal-event-pill.is-holiday { background: #fee2e2; color: #991b1b; }
.cal-event-pill.is-term    { background: #dbeafe; color: #1e40af; }

.cal-canchi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #eef6fc;
    border-bottom: 1px solid #c3daec;
    text-align: center;
}

.cal-canchi-strip > div {
    padding: 7px 4px;
    border-right: 1px solid #d5e5f0;
    color: #0f172a;
}

.cal-canchi-strip > div:last-child {
    border-right: none;
}

.cal-canchi-strip span {
    display: block;
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #4b657c;
}

.cal-canchi-strip strong {
    font-size: 0.78rem;
    font-weight: 700;
}

.cal-box-profile {
    padding: 9px 13px;
    border-bottom: 1px solid #d5e5f0;
    font-size: 0.76rem;
}

.cal-box-profile.is-hop  { background: #effaf2; }
.cal-box-profile.is-xung { background: #fef2f2; }
.cal-box-profile.is-binh { background: #f8fafc; }

.cal-box-profile-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    color: #0f172a;
}

.cal-box-profile-head span {
    font-size: 0.71rem;
    color: #475569;
    font-weight: 600;
}

.cal-pm-list {
    margin: 0;
    padding-left: 16px;
    line-height: 1.4;
}

.cal-pm-note.is-good { color: #14532d; font-weight: 500; }
.cal-pm-note.is-bad  { color: #991b1b; font-weight: 600; }
.cal-pm-note.is-neutral { color: #334155; }

.cal-daiky-alert {
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    padding: 8px 13px;
    font-size: 0.75rem;
    color: #881337;
    line-height: 1.42;
}

.cal-daiky-title {
    font-weight: 700;
    color: #b91c1c;
    margin-bottom: 2px;
}

.cal-three-pillars {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid #c3daec;
    text-align: center;
}

.cal-metric {
    padding: 9px 6px;
    border-right: 1px solid #dce8f2;
}

.cal-metric:last-child {
    border-right: none;
}

.cal-metric-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #4b657c;
}

.cal-metric-val {
    font-size: 0.92rem;
    font-weight: 700;
    margin-top: 2px;
}

.cal-metric-val.is-good { color: #0f7228; }
.cal-metric-val.is-mid  { color: #8a4f10; }
.cal-metric-val.is-bad  { color: #c2181e; }

.cal-metric-sub {
    font-size: 0.67rem;
    color: #475569;
    margin-top: 1px;
}

.cal-do-dont {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #c3daec;
}

.cal-do-box {
    padding: 9px 12px;
    border-right: 1px solid #dce8f2;
    font-size: 0.75rem;
}

.cal-do-box:last-child {
    border-right: none;
}

.cal-do-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cal-do-head.is-good { color: #0f7228; }
.cal-do-head.is-bad  { color: #c2181e; }

.cal-do-box ul {
    margin: 0;
    padding-left: 15px;
    color: #1e293b;
    line-height: 1.42;
}

.cal-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.cal-info-table th,
.cal-info-table td {
    padding: 6px 11px;
    border-bottom: 1px solid #e1edf6;
    text-align: left;
    vertical-align: top;
    line-height: 1.4;
}

.cal-info-table th {
    background: #f2f8fc;
    color: #0b3f6b;
    font-weight: 700;
    width: 86px;
    white-space: nowrap;
}

.cal-info-table td {
    color: #1e293b;
}

.cal-hours-block {
    padding: 10px 12px 12px;
    background: #f8fbfe;
}

.cal-hours-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.72rem;
    color: #0b3f6b;
}

.cal-hours-toggle {
    border: 1px solid #b5cfe3;
    background: #ffffff;
    color: #0e4a77;
    font-family: inherit;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    cursor: pointer;
}

.cal-hours-toggle:hover {
    background: #e3f1fb;
}

.cal-hours-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.cal-hour-item {
    border-radius: 4px;
    padding: 6px 7px;
    border: 1px solid #cde0ee;
    background: #ffffff;
}

.cal-hour-item.is-good {
    border-color: #a7d9b4;
    background: #f0fbf3;
}

.cal-hour-item.is-bad {
    border-color: #e2e8f0;
    background: #f8fafc;
    opacity: 0.82;
}

.cal-hour-top {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    white-space: nowrap;
}

.cal-hour-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #15803d;
    flex-shrink: 0;
}

.cal-hour-item.is-bad .cal-hour-dot {
    background: #94a3b8;
}

.cal-hour-top strong {
    color: #0f172a;
}

.cal-hour-range {
    font-size: 0.69rem;
    color: #475569;
    margin-top: 2px;
    padding-left: 12px;
}

@media (max-width: 1020px) {
    .cal-workspace {
        grid-template-columns: 1fr;
    }

    .cal-filter-bar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .cal-page-card {
        padding: 14px 10px;
    }

    .cal-cell {
        min-height: 58px;
        padding: 4px 3px;
    }

    .cal-hours-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cal-do-dont {
        grid-template-columns: 1fr;
    }

    .cal-do-box {
        border-right: none;
        border-bottom: 1px solid #dce8f2;
    }

    .cal-canchi-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ==========================================================================
   LỊCH CAN CHI THEO NĂM (LƯU NGUYỆT 12 THÁNG DẦN → SỬU + CAN CHI NGÀY)
   ========================================================================== */

.yc-year-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f5f0d8;
    border: 1px solid #d7caa0;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}

.yc-profile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #edf6fc;
    border: 1px solid #c3daec;
    border-radius: 4px;
    padding: 9px 14px;
    margin-bottom: 14px;
}

.yc-section {
    margin-top: 14px;
}

.yc-grid-12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    width: 100%;
    border-top: 1px solid #a8c8e0;
    border-left: 1px solid #a8c8e0;
    background: #ffffff;
}

.yc-month-btn {
    border: none;
    border-right: 1px solid #bed6e8;
    border-bottom: 1px solid #a8c8e0;
    border-radius: 0;
    background: #ffffff;
    text-align: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 100%;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    transition: background 0.12s ease;
}

.yc-month-btn:hover {
    background: #f0f8fe;
}

.yc-month-btn.is-selected {
    background: #f5f0d8;
    box-shadow: inset 0 0 0 2px #0b2a4a;
    z-index: 2;
}

.yc-month-head {
    background: #ebf5fc;
    border-bottom: 1px solid #c6dced;
    padding: 4px 2px;
    font-size: 0.69rem;
    color: #0f172a;
    line-height: 1.2;
}

.yc-month-head strong {
    font-weight: 700;
}

.yc-month-head span {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    color: #3b556b;
}

.yc-month-btn.is-selected .yc-month-head {
    background: #ebe2bc;
}

.yc-month-date {
    font-size: 0.61rem;
    font-weight: 600;
    color: #4b657c;
    padding: 3px 2px 1px;
}

.yc-month-tt {
    font-size: 0.63rem;
    font-weight: 500;
    padding: 2px 1px;
    border-bottom: 1px solid #e7f0f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yc-month-tt.is-bottom {
    border-bottom: none;
    border-top: 1px solid #e7f0f7;
    padding: 3px 1px;
}

.yc-month-gz {
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
    padding: 6px 1px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.yc-month-gz span {
    display: block;
}

.yc-month-napam {
    font-size: 0.6rem;
    font-weight: 500;
    color: #475569;
    padding: 3px 2px 5px;
    border-top: 1px solid #e7f0f7;
    line-height: 1.2;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- DAILY CAN CHI GRID ---------- */
.yc-days-bar {
    padding: 8px 12px;
    align-items: center;
}

.yc-days-bar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.yc-month-switcher {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.yc-month-nav-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #9abed9;
    border-radius: 5px;
    background: #ffffff;
    color: #0b2a4a;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.yc-month-nav-btn:hover:not(:disabled) {
    background: #eff7fd;
    border-color: #0b2a4a;
}

.yc-month-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.yc-month-select {
    height: 30px;
    padding: 0 10px;
    border: 1px solid #9abed9;
    border-radius: 5px;
    background-color: #ffffff;
    color: #0b2a4a;
    font-family: inherit;
    font-size: 0.79rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

.yc-month-select:focus {
    border-color: #0b2a4a;
}

.yc-days-wrap {
    border: 1px solid #a8c8e0;
    border-top: none;
    background: #ffffff;
    padding: 10px;
    transition: opacity 0.14s ease;
}

.yc-days-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
}

.yc-day-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 7px 8px;
    border: 1px solid #cddfeb;
    border-radius: 4px;
    background: #ffffff;
    transition: background 0.12s ease, border-color 0.12s ease;
    text-align: center;
}

.yc-day-tile:hover {
    background: #f0f8fe;
    border-color: #6ea4cc;
}

.yc-day-tile.is-today {
    background: #f5f0d8;
    border-color: #c4b57c;
}

.yc-day-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.68rem;
    border-bottom: 1px solid #e8f1f8;
    padding-bottom: 3px;
}

.yc-day-top strong {
    color: #0b365c;
    font-size: 0.74rem;
}

.yc-day-top span {
    color: #5b7184;
    font-size: 0.63rem;
    white-space: nowrap;
}

.yc-day-gz {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 2px 0 0;
}

.yc-day-tt {
    font-size: 0.66rem;
    font-weight: 500;
}

.yc-day-napam {
    font-size: 0.65rem;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yc-day-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 1px;
    display: inline-block;
    align-self: center;
}

.yc-day-badge.is-good { background: #dcfce7; color: #166534; }
.yc-day-badge.is-warn { background: #fef3c7; color: #92400e; }

/* ---------- SUMMARY TABLE ---------- */
.yc-summary-table td,
.yc-summary-table th {
    padding: 8px 10px;
    font-size: 0.82rem;
}

.yc-summary-row {
    cursor: pointer;
}

.yc-table-gz {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.86rem;
    white-space: nowrap;
}

.yc-tc-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.yc-now-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
}

.yc-rel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}

.yc-rel-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
}

.yc-rel-tag.is-good { background: #dcfce7; color: #166534; }
.yc-rel-tag.is-warn { background: #fef3c7; color: #92400e; }

@media (max-width: 960px) {
    .yc-grid-12 {
        min-width: 780px;
    }

    .yc-days-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .yc-days-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ==========================================================================
   MỐI QUAN HỆ CAN CHI 3 TẦNG (NGUYÊN CỤC → ĐẠI VẬN → LƯU NIÊN)
   ========================================================================== */

.rel-card {
    padding: 14px 18px;
}

.rel-card.is-collapsed {
    padding: 12px 18px;
}

.rel-collapse-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    color: inherit;
}

.rel-trigger-left {
    min-width: 0;
    flex: 1;
}

.rel-trigger-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}

.rel-summary-pills {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.rel-sum-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.69rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef5fb;
    color: #355068;
    border: 1px solid #c5daea;
    white-space: nowrap;
}

.rel-sum-pill.is-hop {
    background: #ecfdf5;
    color: #166534;
    border-color: #a7e3be;
}

.rel-sum-pill.is-xung {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #f4bebe;
}

.rel-toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0b2a4a;
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 999px;
    padding: 6px 12px;
    transition: background 0.14s ease, border-color 0.14s ease;
    white-space: nowrap;
}

.rel-collapse-trigger:hover .rel-toggle-pill {
    background: #dfeef9;
    border-color: #8cb5d4;
}

.rel-toggle-chevron {
    transition: transform 0.18s ease;
    transform: rotate(180deg);
}

.rel-card.is-collapsed .rel-toggle-chevron {
    transform: rotate(0deg);
}

.rel-collapsible-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #d5e5f2;
}

.rel-collapsible-body[hidden] {
    display: none !important;
}

.rel-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.rel-head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

@media (max-width: 720px) {
    .rel-card,
    .rel-card.is-collapsed {
        padding: 12px 13px;
    }

    .rel-collapse-trigger {
        align-items: flex-start;
        gap: 8px;
    }

    .rel-toggle-pill {
        padding: 5px 9px;
        font-size: 0.71rem;
    }

    .rel-toolbar {
        justify-content: flex-start;
    }

    .rel-filter-group {
        width: 100%;
        display: flex;
    }

    .rel-filter-btn {
        flex: 1;
        text-align: center;
        padding: 6px 6px;
        font-size: 0.72rem;
    }
}

/* ---------- LUẬN GIẢI AI THAM KHẢO: MẶC ĐỊNH THU GỌN TRÊN MOBILE (<= 720PX) ---------- */
.ai-collapse-trigger {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0 0 12px;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: default;
}

.ai-trigger-left {
    min-width: 0;
    flex: 1;
}

.ai-trigger-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-trigger-sub {
    font-size: 0.78rem;
    color: var(--ink-muted);
    margin-top: 3px;
    line-height: 1.4;
}

.ai-toggle-pill {
    display: none;
}

.ai-toggle-chevron {
    transition: transform 0.18s ease;
    transform: rotate(180deg);
}

@media (max-width: 720px) {
    .ai-collapse-trigger {
        cursor: pointer;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 0;
    }

    .ai-trigger-title-row {
        justify-content: flex-start;
    }

    .ai-toggle-pill {
        display: inline-flex;
        padding: 5px 9px;
        font-size: 0.71rem;
    }

    .ai-card.is-mobile-collapsed {
        padding: 12px 13px;
    }

    .ai-card.is-mobile-collapsed .ai-toggle-chevron {
        transform: rotate(0deg);
    }

    .ai-card.is-mobile-collapsed .ai-collapsible-body {
        display: none;
    }

    .ai-card:not(.is-mobile-collapsed) .ai-collapsible-body {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #d5e5f2;
    }
}

.rel-subtitle {
    font-size: 0.77rem;
    font-weight: 500;
    color: #3f5c75;
}

.rel-filter-group {
    display: inline-flex;
    background: #eef5fb;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.rel-filter-btn {
    border: none;
    background: transparent;
    color: #355068;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
}

.rel-filter-btn:hover:not(.is-active) {
    background: #dfeef9;
    color: #0b365c;
}

.rel-filter-btn.is-active {
    background: #0b2a4a;
    color: #ffffff;
}

.rel-tiers {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.rel-tier {
    border: 1px solid #b8d2e5;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
}

.rel-tier-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: #e3f1fb;
    border-bottom: 1px solid #bdd6e8;
    padding: 6px 12px;
}

.rel-tier-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #0a3f6b;
}

.rel-tier-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
}

.rel-tier-meta {
    font-size: 0.72rem;
    color: #3b5870;
    font-weight: 500;
}

.rel-list {
    display: flex;
    flex-direction: column;
}

.rel-row {
    padding: 8px 12px;
    border-bottom: 1px solid #e6f0f7;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rel-row:last-child {
    border-bottom: none;
}

.rel-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rel-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
    min-width: 132px;
    justify-content: center;
}

.rel-type-badge.is-hoi     { background: #dcfce7; color: #14532d; border: 1px solid #9bd8af; }
.rel-type-badge.is-hop     { background: #eefaf2; color: #0f7228; border: 1px solid #b9dfc4; }
.rel-type-badge.is-amhop   { background: #e8f4fc; color: #0c4b7a; border: 1px solid #b5d5ec; }
.rel-type-badge.is-xung    { background: #fee2e2; color: #991b1b; border: 1px solid #f4b3b3; }
.rel-type-badge.is-warn    { background: #fef3c7; color: #92400e; border: 1px solid #e9cd83; }
.rel-type-badge.is-special { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; }

.rel-tokens {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.84rem;
    color: #1e293b;
}

.rel-token strong {
    font-weight: 700;
    text-transform: uppercase;
}

.rel-token em {
    font-style: normal;
    font-size: 0.74rem;
    color: #52677a;
    font-weight: 500;
}

.rel-sep {
    color: #94a3b8;
    font-weight: 600;
    margin: 0 2px;
}

.rel-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-left: 142px;
}

.rel-note {
    display: inline-flex;
    align-items: center;
    font-size: 0.73rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    line-height: 1.35;
}

.rel-note.is-break   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.rel-note.is-heal    { background: #ecfdf3; color: #0f7228; border: 1px solid #a7f3d0; }
.rel-note.is-upgrade { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.rel-note.is-compete { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.rel-note.is-trigger { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

.rel-empty {
    padding: 11px 14px;
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
}

@media (max-width: 720px) {
    .rel-notes {
        padding-left: 0;
    }

    .rel-type-badge {
        min-width: 0;
    }
}


/* ==========================================================================
   HỘI VIÊN PRO · PAYWALL MỀM & TRANG NÂNG CẤP (SYNCED ICE-BLUE + NAVY + GOLD)
   ========================================================================== */

.sidebar-pro-pill {
    margin-left: auto;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.2;
}

.sidebar-pro-pill.is-gold {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f5d076;
}

.sidebar-pro-pill.is-pro {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #9bd8af;
}

.sidebar-link.is-active .sidebar-pro-pill {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-pro-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #b45309;
    color: #ffffff;
    border: 1px solid #92400e;
    border-radius: 5px;
    padding: 9px 15px;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-pro-gold:hover {
    background: #92400e;
    color: #ffffff;
}

.btn-pro-gold.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.pro-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 9px;
    border-radius: 4px;
    white-space: nowrap;
}

.pro-pill.is-pro {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #9bd8af;
}

.pro-pill.is-gold {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f3cd74;
}

.pro-pill.is-free {
    background: #eef4f9;
    color: #3b556b;
    border: 1px solid #c5d8e8;
}

.pro-tag-xs {
    display: inline-flex;
    align-items: center;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f2cb6f;
    vertical-align: middle;
}

/* Quota bar trên Danh sách Mệnh Bàn */
.pro-quota-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: #eff7fd;
    border: 1px solid #bcd6e9;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.pro-quota-bar.is-limit {
    background: #fffbeb;
    border-color: #ebd08c;
}

.pro-quota-info {
    flex: 1 1 320px;
    min-width: 0;
}

.pro-quota-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: #0f172a;
}

.pro-quota-sub {
    font-size: 0.76rem;
    color: #475569;
}

.pro-quota-track {
    margin-top: 7px;
    height: 6px;
    background: #d8e7f2;
    border-radius: 99px;
    overflow: hidden;
}

.pro-quota-bar.is-limit .pro-quota-track {
    background: #f5e2b5;
}

.pro-quota-fill {
    height: 100%;
    background: #0d5b9c;
    border-radius: 99px;
}

.pro-quota-bar.is-limit .pro-quota-fill {
    background: #d97706;
}

.pro-limit-box {
    background: #fffdf5;
    border: 1px solid #e9cf8b;
    border-radius: 6px;
    padding: 22px 24px;
    margin-top: 6px;
}

.ql-box {
    padding: 20px 22px;
}

.ql-head {
    margin-bottom: 16px;
}

.ql-title {
    margin: 10px 0 6px;
    font-size: 1.18rem;
    line-height: 1.35;
}

.ql-sub {
    margin: 0;
    color: var(--ink-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
    max-width: 720px;
}

.ql-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ql-card {
    background: #ffffff;
    border: 1px solid #d5e2ee;
    border-radius: 8px;
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ql-card.is-pro {
    background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
    border: 1.5px solid #0b2a4a;
    box-shadow: 0 4px 14px rgba(11, 42, 74, 0.08);
}

.ql-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ql-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ql-card-tag.is-wait {
    background: #eef4fa;
    color: #164872;
}

.ql-card-tag.is-pro {
    background: #fef3c7;
    color: #92400e;
}

.ql-countdown {
    font-size: 0.76rem;
    font-weight: 700;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #f2d388;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.ql-card-title {
    margin: 2px 0 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: #0b2a4a;
}

.ql-card-desc {
    margin: 0;
    font-size: 0.84rem;
    color: var(--ink-secondary);
    line-height: 1.52;
    flex: 1;
}

.ql-card-foot {
    margin-top: 6px;
    display: flex;
}

.ql-card-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}

@media (max-width: 768px) {
    .ql-box {
        padding: 16px 14px;
    }

    .ql-options {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Soft Paywall notice trên Lịch Âm */
.pro-cal-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #fffbeb;
    border: 1px solid #ebd08c;
    border-radius: 4px;
    padding: 9px 13px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.45;
}

.pro-cal-notice > div {
    flex: 1 1 420px;
    min-width: 0;
}

.cal-nav-arrow.is-pro-locked,
.cal-select-sm.is-pro-locked {
    background-color: #f8fafc;
    border-style: dashed;
    color: #475569;
}

.cal-filter-bar.is-pro-locked-bar {
    background: #f6f9fc;
    border-style: dashed;
}

.pro-modal-price-box {
    background: #eff7fd;
    border: 1px solid #bdd6e8;
    border-radius: 5px;
    padding: 10px 12px;
    font-size: 0.83rem;
    color: #0b365c;
}

.pro-modal-price-box em {
    font-style: normal;
    color: #0f7228;
    font-weight: 700;
}

/* Trang Nâng cấp PRO (/app/nang-cap) */
.pro-context-banner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #fffbeb;
    border: 1px solid #e9cf8b;
    border-left: 4px solid #d97706;
    border-radius: 5px;
    padding: 11px 14px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #78350f;
}

.pro-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: #eff7fd;
    border: 1px solid #b8d2e5;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.pro-status-card.is-pro {
    background: #f0fdf4;
    border-color: #9bd8af;
}

.pro-status-eyebrow {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #475569;
    margin-bottom: 5px;
}

.pro-status-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.92rem;
    color: #0f172a;
}

.pro-status-sub {
    margin-top: 6px;
    font-size: 0.79rem;
    color: #334155;
}

.pro-status-email {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334e66;
    background: #ffffff;
    border: 1px solid #c6dced;
    padding: 4px 10px;
    border-radius: 4px;
}

.pro-plans-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.pro-plan-card {
    background: #ffffff;
    border: 1px solid #b8d2e5;
    border-radius: 6px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
}

.pro-plan-card.is-featured {
    border: 2px solid #0b2a4a;
    background: linear-gradient(180deg, #f4f9fe 0%, #ffffff 34%);
    box-shadow: 0 6px 20px rgba(11, 42, 74, 0.08);
}

.pro-plan-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.pro-plan-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0b2a4a;
}

.pro-plan-duration {
    font-size: 0.78rem;
    color: #475569;
    margin-top: 2px;
}

.pro-plan-badge {
    font-size: 0.71rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 4px;
    background: #e3f1fb;
    color: #0a3f6b;
    border: 1px solid #b2cfe4;
    white-space: nowrap;
}

.pro-plan-badge.is-gold {
    background: #fef3c7;
    color: #92400e;
    border-color: #f3cd74;
}

.pro-plan-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.pro-plan-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0b2a4a;
    line-height: 1.1;
}

.pro-plan-old-price {
    font-size: 0.96rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
}

.pro-plan-equiv {
    font-size: 0.81rem;
    color: #334e66;
    margin-bottom: 14px;
    line-height: 1.45;
}

.pro-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
}

.pro-plan-features li {
    position: relative;
    padding-left: 19px;
    font-size: 0.83rem;
    color: #1e293b;
    line-height: 1.42;
}

.pro-plan-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: #0f7228;
    font-weight: 700;
}

.pro-plan-cta {
    margin-top: auto;
}

.pro-support-strip {
    background: #f5f9fd;
    border: 1px solid #c5daea;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #0f172a;
}

.pro-order-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.73rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
}

.pro-order-badge.is-paid {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #9bd8af;
}

.pro-order-badge.is-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f2cb6f;
}

.pro-order-badge.is-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

@media (max-width: 780px) {
    .pro-plans-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   LUẬN GIẢI AI THAM KHẢO (80K) & CẤU HÌNH THƯƠNG HIỆU LÁ SỐ (200K/NĂM)
   ========================================================================== */

.pro-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.pro-section-heading span {
    font-size: 0.78rem;
    color: #475569;
    font-weight: 500;
}

.ai-card {
    padding: 16px 18px;
}

.ai-pitch-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.ai-pitch-col {
    background: #f8fbfe;
    border: 1px solid #c3daec;
    border-radius: 5px;
    padding: 14px 16px;
}

.ai-pitch-col.is-cta {
    background: #ffffff;
    border-color: #a8c8e0;
    display: flex;
    flex-direction: column;
}

.ai-pitch-heading {
    font-size: 0.84rem;
    font-weight: 700;
    color: #0b2a4a;
    margin-bottom: 9px;
}

.ai-pitch-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-pitch-list li {
    position: relative;
    padding-left: 17px;
    font-size: 0.81rem;
    color: #1e293b;
    line-height: 1.42;
}

.ai-pitch-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: #0f7228;
    font-weight: 700;
}

.ai-pitch-note {
    margin: 0 0 12px;
    font-size: 0.81rem;
    color: #334155;
    line-height: 1.5;
}

.ai-price-box {
    background: #eff7fd;
    border: 1px solid #bdd6e8;
    border-radius: 5px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.ai-price-val {
    font-size: 1.45rem;
    font-weight: 700;
    color: #0b2a4a;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.ai-price-sub {
    font-size: 0.75rem;
    color: #3b5870;
    margin-top: 2px;
}

.ai-cta-stack {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-ready-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: #f0fdf4;
    border: 1px solid #9bd8af;
    border-radius: 5px;
    padding: 14px 16px;
}

.ai-loading-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #eff7fd;
    border: 1px solid #b5d2e8;
    border-radius: 5px;
    padding: 14px 16px;
    color: #0b2a4a;
    font-size: 0.86rem;
}

.ai-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #c5dcef;
    border-top-color: #0b2a4a;
    border-radius: 50%;
    flex-shrink: 0;
    animation: aiSpin 0.8s linear infinite;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

.ai-disclaimer {
    background: #f8fafc;
    border: 1px solid #dbe6f0;
    border-radius: 4px;
    padding: 7px 11px;
    font-size: 0.76rem;
    color: #475569;
    margin-bottom: 14px;
}

.ai-prose {
    font-size: 0.88rem;
    line-height: 1.65;
    color: #1e293b;
}

.ai-prose h2,
.ai-prose h3 {
    font-size: 0.96rem;
    font-weight: 700;
    color: #0a3f6b;
    background: #eef6fc;
    border-left: 3px solid #0b2a4a;
    padding: 6px 10px;
    margin: 16px 0 8px;
    border-radius: 2px;
}

.ai-prose h3:first-child {
    margin-top: 0;
}

.ai-prose p {
    margin: 0 0 8px;
}

.ai-prose ul,
.ai-prose ol {
    margin: 0 0 10px;
    padding-left: 20px;
}

.ai-prose li {
    margin-bottom: 4px;
}

.ai-qa-box {
    margin-top: 18px;
    background: #f8fbfe;
    border: 1px solid #b8d2e5;
    border-radius: 6px;
    padding: 14px 16px;
}

.ai-qa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ai-qa-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #0a3f6b;
}

.ai-qa-desc {
    margin: 0 0 10px;
    font-size: 0.81rem;
    color: #334155;
}

.ai-suggest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.ai-chip {
    background: #ffffff;
    border: 1px solid #bfd5e8;
    border-radius: 4px;
    padding: 5px 9px;
    font-family: inherit;
    font-size: 0.75rem;
    color: #0c4878;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.ai-chip:hover {
    background: #e3f1fb;
    border-color: #8cb7d9;
}

.ai-asked-q {
    background: #ffffff;
    border: 1px solid #c5daea;
    border-left: 3px solid #0d5b9c;
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #0f172a;
}

.ai-asked-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #0d5b9c;
    margin-bottom: 3px;
}

.account-quick-actions {
    margin-bottom: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Card Cấu hình Thương hiệu Cá nhân (/app/tai-khoan#thuong-hieu) */
.brand-card {
    background: #f8fbfe;
    border: 1px solid #b8d2e5;
    border-radius: 6px;
    padding: 18px 20px;
    margin-bottom: 24px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.brand-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d5e5f2;
}

.brand-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.brand-grid > * {
    min-width: 0;
    max-width: 100%;
}

.brand-unlock-btn {
    padding: 10px 18px;
    white-space: normal !important;
    text-align: center;
    line-height: 1.35;
    max-width: 100%;
}

.brand-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brand-preview-wrap {
    background: #ffffff;
    border: 1px solid #c3daec;
    border-radius: 5px;
    padding: 12px 14px;
    min-width: 0;
    max-width: 100%;
}

.brand-preview-label {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #475569;
    margin-bottom: 10px;
}

.brand-preview-sheet {
    border: 1px solid #adc9df;
    border-radius: 4px;
    padding: 12px;
    background: #ffffff;
    min-width: 0;
    max-width: 100%;
}

.brand-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
}

.brand-preview-header > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.brand-preview-skeleton {
    background: #eff7fd;
    border: 1px dashed #a8c8e0;
    padding: 22px 10px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #3f5c75;
}

@media (max-width: 820px) {
    .ai-pitch-grid,
    .brand-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* ==========================================================================
   TRẢI NGHIỆM MOBILE APP (ZERO OVERFLOW · SLIDE DRAWER · BOTTOM TAB BAR)
   ========================================================================== */

html, body {
    overflow-x: clip;
    max-width: 100%;
    -webkit-tap-highlight-color: rgba(11, 42, 74, 0.08);
}

main,
.portal-card,
.cal-page-card,
.mb-stack,
.mb-unified-box,
.mb-card,
.table-wrap,
.mb-table-scroll,
.mb-strip-scroll {
    min-width: 0;
    max-width: 100%;
}

.table-wrap,
.mb-table-scroll,
.mb-strip-scroll {
    -webkit-overflow-scrolling: touch;
}

.drawer-mobile-head,
.drawer-admin-mobile,
.mobile-drawer-backdrop,
.mobile-bottom-nav,
.mb-mobile-swipe-hint {
    display: none;
}

@media (max-width: 920px) {
    /* 1. Khắc phục triệt để lỗi CSS Grid 1fr làm tràn ngang toàn trang */
    .portal-shell {
        grid-template-columns: minmax(0, 1fr) !important;
        padding: 12px 10px calc(82px + env(safe-area-inset-bottom, 0px)) !important;
        gap: 12px;
    }

    /* 2. Topbar gọn chuẩn Mobile App (56px) */
    .portal-topbar-inner {
        height: 56px;
        padding: 0 12px;
        gap: 10px;
    }

    .portal-brand {
        gap: 9px;
    }

    .portal-brand-logo {
        width: 32px;
        height: 32px;
    }

    .portal-brand-title {
        font-size: 0.92rem;
        letter-spacing: 0.04em;
    }

    .portal-brand-sub {
        font-size: 0.58rem;
        letter-spacing: 0.08em;
        margin-top: 2px;
    }

    .portal-topbar-right {
        gap: 8px;
        flex-shrink: 0;
    }

    .portal-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.84rem;
    }

    .topbar-admin-desktop,
    .portal-user-meta,
    .topbar-logout-desktop {
        display: none !important;
    }

    .btn-mobile-menu {
        display: inline-flex !important;
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    /* 3. Slide-out Navigation Drawer với Backdrop mờ */
    .mobile-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(8, 32, 58, 0.52);
        backdrop-filter: blur(2px);
        z-index: 85;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .mobile-drawer-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .portal-sidebar {
        display: flex !important;
        flex-direction: column;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 286px;
        max-width: 84vw;
        height: 100dvh;
        z-index: 90;
        border-radius: 0 14px 14px 0;
        border: none;
        padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        box-shadow: 6px 0 28px rgba(8, 32, 58, 0.25);
        transform: translateX(-105%);
        transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .portal-sidebar.is-open {
        transform: translateX(0);
    }

    .drawer-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-bottom: 12px;
        margin-bottom: 10px;
        border-bottom: 1px solid #e2edf5;
    }

    .drawer-close-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid #cbd9e6;
        background: #f4f8fc;
        color: #0b2a4a;
        font-size: 0.95rem;
        font-weight: 700;
        cursor: pointer;
        flex-shrink: 0;
    }

    .drawer-admin-mobile {
        display: inline-flex !important;
    }

    .sidebar-link {
        padding: 11px 12px;
        font-size: 0.92rem;
    }

    /* 4. Bottom Tab Bar cố định đáy màn hình giống Native Mobile App */
    .mobile-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(10px);
        border-top: 1px solid #c6dced;
        box-shadow: 0 -3px 16px rgba(11, 42, 74, 0.08);
        padding: 5px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .mbn-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #546b82;
        font-size: 0.66rem;
        font-weight: 600;
        padding: 4px 2px 2px;
        text-decoration: none;
        min-width: 0;
        transition: color 0.14s ease;
    }

    .mbn-item svg {
        width: 21px;
        height: 21px;
        flex-shrink: 0;
    }

    .mbn-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .mbn-item.is-active {
        color: #0b2a4a;
        font-weight: 700;
    }

    .mbn-item.is-center-fab {
        position: relative;
        padding-top: 0;
    }

    .mbn-fab-circle {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: #0b2a4a;
        color: #ffffff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-top: -18px;
        margin-bottom: 2px;
        box-shadow: 0 4px 12px rgba(11, 42, 74, 0.34);
        border: 3px solid #ffffff;
    }

    .mbn-fab-circle svg {
        width: 20px;
        height: 20px;
    }

    .mbn-item.is-center-fab.is-active .mbn-fab-circle {
        background: #134a7d;
    }

    /* 5. Thẻ nội dung & Tiêu đề gọn kiểu App */
    .portal-card,
    .cal-page-card {
        padding: 16px 13px !important;
        border-radius: 10px;
    }

    .mb-unified-box,
    .mb-card {
        padding: 13px 11px !important;
        border-radius: 10px;
    }

    .page-header-row {
        gap: 10px;
        padding-bottom: 12px;
        margin-bottom: 14px;
    }

    .page-header-row > div:first-child {
        flex: 1 1 100%;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions > a,
    .page-header-actions > button {
        width: 100%;
        justify-content: center;
    }

    .page-title {
        font-size: 1.28rem !important;
    }

    .page-desc {
        font-size: 0.83rem;
    }

    /* 6. Mệnh Bàn trên Mobile: xếp dọc phần đầu, bảng cuộn ngang mượt trong khung */
    .mb-head-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .mb-person-compact {
        flex: none !important;
        width: 100%;
        max-width: 100% !important;
    }

    .mb-person-item strong {
        white-space: normal;
        word-break: break-word;
    }

    .mb-mobile-swipe-hint {
        display: block;
        text-align: center;
        font-size: 0.69rem;
        font-weight: 600;
        color: #165282;
        background: #f0f7fd;
        border-left: 1px solid #a8c8e0;
        border-right: 1px solid #a8c8e0;
        padding: 4px 8px;
    }

    .mb-tinhban {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: fixed;
        font-size: 0.72rem;
    }

    .mb-unified-box:not(.is-exporting) .mb-col-van {
        display: none !important;
    }

    .mb-unified-box:not(.is-exporting) .mb-lbl-full {
        display: none;
    }

    .mb-unified-box:not(.is-exporting) .mb-lbl-short {
        display: inline;
    }

    .mb-unified-box:not(.is-exporting) .mb-tc-pct {
        display: none;
    }

    .mb-unified-box:not(.is-exporting) .mb-strip-mobile-tag {
        display: inline-flex;
        align-items: center;
        font-size: 0.65rem;
        font-weight: 700;
        color: #0b3a66;
        background: #eaf4fc;
        border: 1px solid #b6d2e6;
        border-radius: 999px;
        padding: 2px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mb-unified-box:not(.is-exporting) .mb-strip-bar.is-center {
        justify-content: space-between;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-mobile-bar {
        display: flex !important;
    }

    .mb-tinhban .col-label {
        width: 52px;
        font-size: 0.64rem;
        padding: 5px 2px;
    }

    .mb-tinhban th,
    .mb-tinhban td {
        padding: 5px 2px;
    }

    .mb-tinhban thead th {
        font-size: 0.7rem;
    }

    .mb-tinhban thead th .sub {
        font-size: 0.66rem;
    }

    .mb-gz-big {
        font-size: 1.18rem;
        line-height: 1.18;
    }

    .mb-tangcan-line {
        font-size: 0.57rem;
        line-height: 1.32;
        letter-spacing: -0.02em;
        white-space: nowrap;
    }

    .mb-row-napam td {
        font-size: 0.63rem;
        line-height: 1.2;
    }

    .mb-row-italic td {
        font-size: 0.66rem;
    }

    .mb-footnote {
        font-size: 0.61rem;
        line-height: 1.35;
    }

    /* ĐẠI VẬN & LƯU NIÊN: 2 HÀNG × 5 Ô VỪA KHÍT 100% MÀN HÌNH MOBILE */
    .mb-unified-box:not(.is-exporting) .mb-strip-scroll {
        overflow-x: visible;
    }

    .mb-unified-box:not(.is-exporting) .mb-grid-10 {
        min-width: 0 !important;
        width: 100% !important;
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        row-gap: 6px;
        background: transparent;
        border-top: none;
        border-left: none;
    }

    .mb-unified-box:not(.is-exporting) .mb-grid-10 .mb-tile {
        border: 1px solid #bfd5e6;
        border-right: none;
    }

    .mb-unified-box:not(.is-exporting) .mb-grid-10 .mb-tile:nth-child(5n),
    .mb-unified-box:not(.is-exporting) .mb-grid-10 .mb-tile:last-child {
        border-right: 1px solid #bfd5e6;
    }

    .mb-unified-box:not(.is-exporting) .mb-tile-head {
        flex-direction: column;
        height: auto;
        padding: 3px 1px;
        font-size: 0.68rem;
        line-height: 1.12;
    }

    .mb-unified-box:not(.is-exporting) .mb-tile-age {
        margin-left: 0;
        font-size: 0.59rem;
    }

    .mb-unified-box:not(.is-exporting) .mb-tile-tt {
        font-size: 0.59rem;
        height: 20px;
        padding: 1px 1px;
        letter-spacing: -0.01em;
    }

    .mb-unified-box:not(.is-exporting) .mb-tile-gz {
        font-size: 0.92rem;
        padding: 4px 1px;
        line-height: 1.15;
    }

    /* THẦN SÁT 6 CỘT GỌN VỪA KHÍT 390PX (KHÔNG CẦN VUỐT NGANG) */
    .mb-unified-box:not(.is-exporting) .mb-thansat-table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: fixed;
    }

    .mb-unified-box:not(.is-exporting) .mb-thansat-table th,
    .mb-unified-box:not(.is-exporting) .mb-thansat-table td {
        padding: 4px 2px;
        vertical-align: top;
    }

    .mb-unified-box:not(.is-exporting) .mb-thansat-table thead th {
        font-size: 0.59rem;
        line-height: 1.18;
    }

    .mb-unified-box:not(.is-exporting) .mb-thansat-table thead th .sub {
        font-size: 0.55rem;
        margin-top: 1px;
    }

    .mb-unified-box:not(.is-exporting) .mb-star-list {
        gap: 3px;
        font-size: 0.58rem;
        line-height: 1.22;
        word-break: break-word;
    }

    /* PHỤ TRỢ & VẬN KHÍ: 4 CUNG 1 HÀNG NGANG + BẢNG 3 DÒNG BÊN DƯỚI */
    .mb-unified-box:not(.is-exporting) .mb-aux-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-cards {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-card-head {
        font-size: 0.63rem;
        padding: 4px 2px;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-card-body {
        padding: 6px 2px;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-gz {
        font-size: 0.88rem;
        line-height: 1.18;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-napam {
        font-size: 0.6rem;
        line-height: 1.2;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-info-table {
        font-size: 0.72rem;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-info-table th {
        width: 72px;
        padding: 6px 8px;
    }

    .mb-unified-box:not(.is-exporting) .mb-aux-info-table td {
        padding: 6px 9px;
    }

    .mb-export-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }

    .mb-btn-download-hero,
    .mb-export-brand-btn {
        width: 100%;
    }

    .mb-back-btn,
    .mb-footer-cta,
    .mb-branding-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .mb-branding-card {
        padding: 13px 14px;
        gap: 12px;
    }

    .mb-bottom-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mb-bottom-actions > #btnDownloadChart {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 44px;
    }

    .mb-bottom-actions > a,
    .mb-bottom-actions > button {
        width: 100%;
        justify-content: center;
        text-align: center;
        white-space: normal;
        line-height: 1.25;
        padding: 9px 10px;
        font-size: 0.8rem;
    }

    /* 7. Bảng Mối quan hệ 3 tầng trên Mobile */
    .rel-head-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .rel-filter-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .rel-filter-btn {
        font-size: 0.7rem;
        padding: 7px 4px;
        text-align: center;
        white-space: normal;
        line-height: 1.2;
    }

    .rel-notes {
        padding-left: 0 !important;
    }

    .rel-type-badge {
        min-width: 0 !important;
        font-size: 0.7rem;
    }

    .rel-tokens {
        font-size: 0.8rem;
    }

    /* 8. Lịch Âm & Ngày Tốt trên Mobile — 7 CỘT T2..CN VỪA KHÍT 100% MÀN HÌNH */
    .cal-nav-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) 38px;
        gap: 6px;
    }

    .cal-nav-controls > .btn-navy,
    .cal-nav-controls > .btn-pro-gold {
        grid-column: 1 / -1;
        width: 100%;
        height: 38px !important;
    }

    .cal-select-sm {
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 8px !important;
        padding-right: 24px !important;
        font-size: 0.82rem !important;
    }

    .cal-nav-arrow {
        width: 100%;
        padding: 0 !important;
        justify-content: center;
    }

    .cal-filter-bar {
        padding: 10px 10px;
        gap: 10px;
    }

    .cal-filter-item {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .cal-filter-item label {
        white-space: normal;
        font-size: 0.78rem;
    }

    .cal-select-filter {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
    }

    .pro-cal-notice {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pro-cal-notice > div {
        flex: none;
    }

    .pro-cal-notice > a {
        width: 100%;
        text-align: center;
    }

    .cal-best-strip {
        padding: 8px 10px;
    }

    .cal-best-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        align-items: center;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .cal-best-label {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .cal-best-chip {
        flex-shrink: 0;
    }

    .cal-grid-card {
        overflow: hidden;
    }

    .cal-grid-headbar {
        padding: 7px 9px;
        gap: 6px;
    }

    .cal-legend {
        gap: 8px;
        font-size: 0.68rem;
    }

    .cal-weekdays > div {
        font-size: 0.7rem;
        padding: 5px 1px;
    }

    .cal-cell {
        min-width: 0 !important;
        min-height: 54px !important;
        padding: 3px 2px !important;
        overflow: hidden;
    }

    .cal-solar-num {
        font-size: 0.82rem !important;
    }

    .cal-dot {
        width: 6px !important;
        height: 6px !important;
    }

    .cal-lunar-num {
        font-size: 0.64rem !important;
    }

    .cal-cell-canchi,
    .cal-cell-tag {
        font-size: 0.56rem !important;
        padding: 1px 2px !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cal-detail-hero {
        padding: 12px 12px;
        gap: 10px;
    }

    .cal-detail-solar {
        font-size: 1.25rem;
    }

    .cal-rating-box {
        min-width: 84px;
        padding: 6px 8px;
    }

    .cal-three-pillars {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cal-metric {
        padding: 8px 3px;
    }

    .cal-metric-val {
        font-size: 0.8rem;
    }

    /* 9. Lịch Can Chi năm trên Mobile */
    #ycFilterForm.cal-nav-controls {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
    }

    .yc-grid-12 {
        min-width: 680px !important;
    }

    .yc-year-pill {
        font-size: 0.84rem;
        padding: 2px 8px;
        margin-left: 4px;
    }

    /* 10. Quota bar & Trang Nâng cấp PRO & Tài khoản */
    .pro-quota-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 9px;
        padding: 11px 12px;
    }

    .pro-quota-info {
        flex: none;
    }

    .pro-quota-bar > a {
        width: 100%;
        justify-content: center;
    }

    .pro-status-card {
        padding: 13px 14px;
    }

    .pro-status-email {
        word-break: break-all;
        font-size: 0.76rem;
    }

    .pro-plan-card {
        padding: 16px 15px;
    }

    .pro-plan-price {
        font-size: 1.55rem;
    }

    .pro-compare-table th,
    .pro-compare-table td {
        padding: 8px 8px;
        font-size: 0.79rem;
    }

    .account-quick-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .account-quick-actions > a {
        width: 100%;
        justify-content: center;
        text-align: center;
        white-space: normal;
        line-height: 1.3;
    }

    .brand-card {
        padding: 14px 13px;
    }

    .brand-unlock-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .brand-preview-wrap {
        padding: 10px;
    }

    .brand-preview-sheet {
        padding: 10px;
    }

    .brand-preview-skeleton {
        padding: 16px 8px;
        line-height: 1.45;
    }

    /* 11. Form Lập Mệnh Bàn & Đổi Âm Lịch gọn gàng như Native App */
    .form-panel-head {
        padding: 8px 12px;
    }

    .form-panel-body {
        padding: 13px 12px 15px;
        gap: 12px;
    }

    .form-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
        align-items: end;
    }

    .form-grid-3 .form-label-warm {
        font-size: 0.76rem;
        white-space: nowrap;
    }

    .form-grid-3 .form-label-warm > span:nth-child(2) {
        display: none;
    }

    .form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        align-items: end;
    }

    .form-input {
        font-size: 0.88rem;
        padding: 8px 10px;
    }

    .form-select-warm {
        font-size: 0.86rem;
        padding: 8px 28px 8px 10px;
        background-position: right 8px center;
        background-size: 14px 14px;
    }

    .form-grid-3 .form-select-warm {
        padding: 8px 20px 8px 7px;
        font-size: 0.8rem;
        background-position: right 5px center;
        background-size: 12px 12px;
    }

    .form-grid-2 .form-label-warm {
        font-size: 0.79rem;
        white-space: nowrap;
    }

    .overseas-box {
        padding: 12px;
        gap: 10px;
    }

    .overseas-grid-2,
    .overseas-meta-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .overseas-box .form-label-warm {
        font-size: 0.8rem;
        white-space: normal;
    }

    .form-actions-bar,
    .form-actions-left {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions-left > button,
    .form-actions-left > a {
        width: 100%;
        min-height: 44px;
    }

    .converter-row {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .converter-submit-col {
        grid-column: 1 / -1;
    }

    .mode-switch {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mode-btn {
        padding: 7px 6px;
        font-size: 0.76rem;
        text-align: center;
    }

    .canchi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }
}

/* 12. DANH SÁCH MỆNH BÀN CHUYỂN THÀNH APP CARD LIST TRÊN MOBILE (<= 720PX, ZERO CUỘN NGANG!) */
@media (max-width: 720px) {
    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
    }

    .search-group {
        max-width: 100%;
        flex: none;
    }

    .filter-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .filter-tab {
        justify-content: center;
    }

    .table-wrap:has(.profiles-table) {
        border: none;
        background: transparent;
        overflow: visible;
    }

    .profiles-table,
    .profiles-table tbody {
        display: block;
        width: 100%;
    }

    .profiles-table thead {
        display: none;
    }

    .profiles-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 7px;
        background: #ffffff;
        border: 1px solid #bfd6e8;
        border-radius: 10px;
        padding: 12px 13px;
        margin-bottom: 10px;
        box-shadow: 0 2px 6px rgba(11, 42, 74, 0.04);
    }

    .profiles-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .profiles-table tbody td {
        display: block;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        white-space: normal !important;
        text-align: left !important;
    }

    .profiles-table .profile-name-link {
        max-width: none;
        font-size: 0.98rem;
    }

    .profiles-table .profile-sub-note {
        max-width: none;
        white-space: normal;
    }

    .profiles-table .pillars-inline {
        flex-wrap: wrap;
        font-size: 0.8rem;
        background: #f4f9fd;
        border: 1px solid #d5e6f3;
        border-radius: 6px;
        padding: 6px 9px;
        width: 100%;
        justify-content: center;
    }

    .profiles-table .row-actions {
        display: grid;
        grid-template-columns: 1.5fr 1fr auto;
        gap: 7px;
        width: 100%;
        padding-top: 6px;
        border-top: 1px solid #e7f0f7;
    }

    .profiles-table .row-actions > a,
    .profiles-table .row-actions > form,
    .profiles-table .row-actions > form > button {
        width: 100%;
        min-height: 36px;
        justify-content: center;
    }

    .stat-strip {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .portal-modal {
        padding: 18px 16px;
        border-radius: 12px;
        max-height: 90dvh;
        overflow-y: auto;
    }
}


/* ============================================================
   LỤC HÀO NẠP GIÁP · GIỜ ĐỘNG TÂM
   ============================================================ */
.lh-cast-card {
    background: #fbfdff;
    border: 1px solid #c5daea;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 24px;
}

.lh-cast-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dce9f3;
}

.lh-cast-title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--navy);
}

.lh-cast-sub {
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-top: 2px;
}

.lh-panel-head-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lh-history-divider {
    height: 1px;
    background: #dce8f3;
    margin: 26px 0 20px;
}

.lh-toolbar-cat {
    width: auto;
    min-width: 190px;
    height: 40px;
    padding: 0 30px 0 12px;
    font-size: 0.84rem;
}

.lh-sub-box {
    background: #fbfdff;
    border: 1px solid #cfe0ee;
    border-radius: 7px;
    padding: 12px 14px;
}

.lh-sub-box-title {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #0b2a4a;
    margin-bottom: 10px;
}

.lh-hint-bar {
    background: #f0f7fd;
    border: 1px solid #c7dff0;
    border-left: 3px solid var(--navy);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.82rem;
    color: #1e3a57;
    line-height: 1.45;
}

.lh-rule-note {
    font-size: 0.78rem;
    color: #47627a;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 8px 11px;
    margin-bottom: 14px;
    line-height: 1.45;
}

.lh-submit-row {
    display: flex;
    justify-content: flex-end;
}

.lh-history-section {
    margin-top: 8px;
}

.lh-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.lh-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lh-search-input {
    width: 200px;
    padding: 7px 11px;
    font-size: 0.84rem;
}

.lh-cat-select {
    width: 210px;
    padding: 7px 11px;
    font-size: 0.84rem;
}

.lh-mobile-list {
    display: none;
}

/* --- Chi tiết Bảng An Quẻ Lục Hào --- */
.lh-head-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lh-pill-navy {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: #0b2a4a;
    color: #ffffff;
}

.lh-pill-gold {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f5d380;
}

.lh-question-banner {
    background: linear-gradient(180deg, #f5faff 0%, #eef6fc 100%);
    border: 1px solid #c3daec;
    border-left: 4px solid #0b2a4a;
    border-radius: 7px;
    padding: 12px 15px;
    margin: 12px 0;
}

.lh-q-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #466580;
    margin-bottom: 4px;
}

.lh-q-person {
    color: #0b2a4a;
    letter-spacing: 0;
    font-weight: 600;
}

.lh-q-text {
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}

.lh-q-dungthan {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #334e68;
}

.lh-time-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 0 6px;
}

.lh-time-meta {
    font-size: 0.83rem;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lh-meta-k {
    color: #526b82;
    font-weight: 600;
}

.lh-meta-muted {
    color: #64748b;
    font-size: 0.79rem;
}

.lh-early-rat-note {
    font-size: 0.76rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 5px;
    padding: 4px 8px;
    margin-top: 3px;
    display: inline-block;
}

.lh-pillars-strip {
    display: flex;
    align-items: stretch;
    gap: 7px;
    flex-wrap: wrap;
}

.lh-pillar-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f8fbfe;
    border: 1px solid #c7dceb;
}

.lh-pillar-chip.is-highlight {
    background: #eef6fd;
    border-color: #8cb7d9;
}

.lh-pillar-chip.is-khong {
    background: #fffbeb;
    border-color: #f3d082;
}

.lh-p-lbl {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #516b82;
    margin-bottom: 2px;
}

.lh-p-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.lh-formula-strip {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #d0e1ee;
    font-size: 0.76rem;
    color: #48647c;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    line-height: 1.45;
}

/* Tiêu đề Quẻ Chủ -> Quẻ Biến */
.lh-hex-titles-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.lh-hex-title-box {
    border: 1px solid #bfd7ea;
    border-radius: 7px;
    padding: 11px 14px;
    background: #f6fbff;
}

.lh-hex-title-box.is-changed {
    background: #fdfcf7;
    border-color: #e6d5a9;
}

.lh-hex-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lh-hex-title-body {
    min-width: 0;
    flex: 1;
}

/* Tượng quẻ 6 vạch Kinh Dịch trong khung Quẻ Chủ & Quẻ Biến */
.lh-title-hex {
    width: 48px;
    padding: 7px 6px;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid #c5daea;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.lh-title-hex.is-changed-hex {
    border-color: #e6d5a9;
    background: #fffefb;
}

.lh-title-yao {
    height: 4.5px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.lh-title-yao.is-trigram-gap {
    margin-bottom: 3px;
}

.lh-title-yao span {
    display: block;
    height: 100%;
    flex: 1;
    border-radius: 0.5px;
    background: #102a43;
}

.lh-title-hex.is-changed-hex .lh-title-yao span {
    background: #2c4863;
}

.lh-title-yao.is-moving-bar span {
    background: #b91c1c !important;
}

.lh-hex-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #4b6882;
    margin-bottom: 2px;
}

.lh-hex-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.22rem;
    font-weight: 700;
    color: #0b2a4a;
    line-height: 1.22;
}

.lh-hex-trigrams {
    margin-top: 2px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #36536e;
    line-height: 1.3;
}

.lh-hex-meta {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed #d7e5f0;
    font-size: 0.77rem;
    color: #466078;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lh-hex-title-box.is-changed .lh-hex-meta {
    border-top-color: #ede1c2;
}

.lh-hex-arrow {
    font-size: 1.35rem;
    font-weight: 700;
    color: #b45309;
    text-align: center;
}

.lh-special-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.lh-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
}

.lh-tag.is-good,
.lh-mini-tag.is-good {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #a7e3be;
}

.lh-tag.is-danger,
.lh-mini-tag.is-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #f5bcbc;
}

.lh-tag.is-warn,
.lh-mini-tag.is-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #f5d380;
}

.lh-tag.is-info,
.lh-mini-tag.is-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Bảng 6 Hào Nạp Giáp */
.lh-table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.lh-table thead th {
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 9px 10px;
    text-align: left;
    border: 1px solid #0b2a4a;
}

.lh-table tbody td {
    padding: 10px 10px;
    border: 1px solid #d4e3ef;
    vertical-align: middle;
    background: #ffffff;
}

.lh-row.is-the-row td {
    background: #f5faff;
}

.lh-row.is-moving-row td {
    background: #fffcf0;
}

.lh-row.is-dungthan-row td:first-child {
    box-shadow: inset 3px 0 0 #b45309;
}

.lh-col-pos {
    text-align: center;
    white-space: nowrap;
}

.lh-pos-hanzi {
    display: block;
    font-weight: 800;
    font-size: 0.9rem;
    color: #0b2a4a;
    line-height: 1.2;
}

.lh-pos-num {
    display: block;
    font-weight: 800;
    font-size: 0.86rem;
    color: #0b2a4a;
}

.lh-pos-lbl {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
}

.lh-lucthu-name {
    font-weight: 700;
    color: #294660;
    font-size: 0.82rem;
    white-space: nowrap;
}

.lh-phuc-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.76rem;
}

.lh-phuc-lt {
    font-weight: 700;
    color: #5b4636;
}

.lh-phuc-cc {
    font-weight: 700;
    font-size: 0.77rem;
}

.lh-empty-dash {
    color: #94a3b8;
    font-size: 0.82rem;
}

.lh-hex-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lh-hex-cell.is-changed-cell {
    justify-content: flex-start;
}

.lh-line-info {
    min-width: 0;
    flex: 1;
}

.lh-line-top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lh-lucthan {
    font-weight: 700;
    color: #1e3a57;
    font-size: 0.84rem;
    white-space: nowrap;
}

.lh-lucthan.is-target {
    color: #9a3412;
}

.lh-lucthan.is-dim,
.lh-canchi.is-dim {
    opacity: 0.62;
}

.lh-canchi {
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.lh-the-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 4px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.69rem;
    font-weight: 800;
}

.lh-ung-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #e6c46d;
    font-size: 0.69rem;
    font-weight: 800;
}

.lh-line-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.lh-str-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.67rem;
    font-weight: 700;
}

.lh-str-badge.is-vuong { background: #dcfce7; color: #166534; }
.lh-str-badge.is-tuong { background: #e0f2fe; color: #075985; }
.lh-str-badge.is-huu   { background: #f1f5f9; color: #475569; }
.lh-str-badge.is-tu    { background: #fef3c7; color: #92400e; }
.lh-str-badge.is-tuyet { background: #fee2e2; color: #991b1b; }

.lh-mini-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.67rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Đồ họa vạch Hào Dương / Hào Âm chuẩn Kinh Dịch (tỷ lệ khe đứt ~1/5, cạnh sắc) */
.lh-table tbody tr.is-trigram-split td {
    border-bottom: 2px solid #8eb0cc;
}

.lh-yao-bar {
    width: 82px;
    height: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.lh-yao-seg {
    display: block;
    height: 8px;
    border-radius: 1px;
    background: #102a43;
}

.lh-yao-seg.is-full {
    width: 100%;
}

.lh-yao-seg.is-half {
    flex: 1;
}

.lh-yao-bar.is-moving .lh-yao-seg {
    background: #b91c1c;
}

.lh-yao-bar.is-changed-active .lh-yao-seg {
    background: #b91c1c;
}

.lh-yao-bar.is-changed-static .lh-yao-seg {
    background: #334e68;
}

.lh-yao-bar.is-muted .lh-yao-seg {
    background: #64748b;
    opacity: 0.75;
}

.lh-col-move {
    text-align: center;
}

/* Ký hiệu Hào Động chuẩn Kinh Dịch: ○ (Lão Dương) / × (Lão Âm) đỏ son */
.lh-move-sym {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #b91c1c;
    background: transparent;
}

.lh-move-sym svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Hàng dưới: Quẻ Hỗ + Thần Sát */
.lh-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.85fr);
    gap: 14px;
}

.lh-nuclear-body {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lh-mini-hex {
    width: 58px;
    display: flex;
    flex-direction: column;
    gap: 4.5px;
    flex-shrink: 0;
    padding: 8px 7px;
    background: #f5faff;
    border: 1px solid #c5daea;
    border-radius: 5px;
}

.lh-mini-yao {
    height: 4.5px;
    display: flex;
    justify-content: space-between;
    gap: 9px;
}

.lh-mini-yao.is-trigram-gap {
    margin-bottom: 3px;
}

.lh-mini-yao span {
    display: block;
    height: 100%;
    border-radius: 0.5px;
    background: #102a43;
    flex: 1;
}

/* Micro tượng quẻ 6 vạch cho Sổ Quẻ Lục Hào */
.lh-hist-hex-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lh-micro-hex-pair {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.lh-micro-arrow {
    font-size: 0.68rem;
    font-weight: 700;
    color: #b45309;
    line-height: 1;
}

.lh-micro-hex {
    width: 22px;
    padding: 3px;
    border-radius: 3px;
    background: #f8fbfe;
    border: 1px solid #d1e1ee;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.lh-micro-yao {
    height: 2.2px;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.lh-micro-yao.is-gap {
    margin-bottom: 1.5px;
}

.lh-micro-yao span {
    display: block;
    height: 100%;
    flex: 1;
    background: #102a43;
}

.lh-micro-yao.is-mv span {
    background: #b91c1c;
}

.lh-mobile-hex-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.lh-nuclear-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0b2a4a;
}

.lh-nuclear-meta {
    font-size: 0.8rem;
    color: #47627a;
    margin-top: 3px;
    line-height: 1.45;
}

.lh-thansat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.lh-star-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 6px;
    border: 1px solid #d2e2ef;
    background: #f8fbfe;
    font-size: 0.77rem;
}

.lh-star-chip.is-good {
    background: #f2fdf7;
    border-color: #bfe8cf;
}

.lh-star-chip.is-danger {
    background: #fef6f6;
    border-color: #f3c8c8;
}

.lh-star-name {
    color: #466078;
    font-weight: 600;
    white-space: nowrap;
}

.lh-star-chi {
    color: #0b2a4a;
    font-weight: 800;
    white-space: nowrap;
}

.lh-history-table {
    min-width: 0 !important;
    width: 100%;
    table-layout: fixed;
}

.lh-history-table td {
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.lh-history-table .profile-name-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal !important;
    max-width: 100%;
    line-height: 1.4;
}

.lh-capture-wrap,
.lh-capture-wrap .mb-section {
    min-width: 0;
    max-width: 100%;
}

.lh-capture-wrap .mb-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lh-phuc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}

.lh-stage-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #d5e0ec;
    white-space: nowrap;
}

.lh-stage-badge.is-good {
    background: #effaf3;
    color: #166534;
    border-color: #bde6cc;
}

.lh-stage-badge.is-danger {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.lh-mobile-board {
    display: none;
}

.lh-capture-wrap.is-exporting {
    width: 1120px !important;
    max-width: 1120px !important;
    padding: 18px !important;
    background: #ffffff !important;
}

.lh-capture-wrap.is-exporting .lh-desktop-board {
    display: block !important;
}

.lh-capture-wrap.is-exporting .lh-mobile-board {
    display: none !important;
}

.lh-capture-wrap.is-exporting .mb-table-scroll {
    overflow: visible !important;
}

/* Responsive Mobile App (<= 720px) */
@media (max-width: 720px) {
    .lh-cast-card {
        padding: 14px 13px;
    }

    .lh-meta-grid-2 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #lucHaoCastForm .form-panel,
    #lucHaoCastForm .form-panel-body,
    #lucHaoCastForm .form-grid-3 > div,
    #lucHaoCastForm .form-grid-2 > div {
        min-width: 0;
        max-width: 100%;
    }

    #lucHaoCastForm .form-input,
    #lucHaoCastForm .form-select-warm {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    #lucHaoCastForm .form-label-warm {
        flex-wrap: wrap;
        gap: 4px;
    }

    .lh-panel-head-tools {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
    }

    .lh-panel-head-tools .seg-control {
        flex: 1 1 180px;
        min-width: 0;
    }

    .lh-toolbar-cat {
        width: 100%;
        min-width: 0;
    }

    .lh-submit-row .btn-navy {
        width: 100%;
        text-align: center;
    }

    .lh-filter-bar {
        width: 100%;
    }

    .lh-search-input,
    .lh-cat-select {
        flex: 1 1 140px;
        width: auto;
    }

    .lh-desktop-table {
        display: none;
    }

    .lh-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .lh-mobile-card {
        background: #ffffff;
        border: 1px solid #cfe0ee;
        border-radius: 10px;
        padding: 12px 13px;
        box-shadow: 0 2px 6px rgba(11, 42, 74, 0.04);
    }

    .lh-mobile-card-main {
        display: block;
        text-decoration: none;
        color: inherit;
    }

    .lh-mobile-hex-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        flex-wrap: wrap;
        margin-bottom: 6px;
    }

    .lh-mobile-hex-badge {
        font-size: 0.78rem;
        font-weight: 800;
        color: #0b2a4a;
    }

    .lh-mobile-move-pill {
        font-size: 0.69rem;
        font-weight: 700;
        padding: 2px 7px;
        border-radius: 999px;
        background: #fff7ed;
        color: #c2410c;
        border: 1px solid #fed7aa;
    }

    .lh-mobile-question {
        font-size: 0.91rem;
        font-weight: 600;
        color: #0f172a;
        line-height: 1.4;
        margin-bottom: 5px;
    }

    .lh-mobile-meta {
        font-size: 0.75rem;
        color: #64748b;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .lh-mobile-card-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 10px;
        padding-top: 9px;
        border-top: 1px solid #e5eff7;
    }

    .lh-hex-titles-grid {
        grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
        gap: 5px;
        align-items: stretch;
        margin-bottom: 10px;
    }

    .lh-hex-title-box {
        padding: 7px 8px;
    }

    .lh-hex-title-row {
        gap: 7px;
        align-items: flex-start;
    }

    .lh-title-hex {
        width: 30px;
        padding: 4px 3.5px;
        gap: 2.5px;
        border-radius: 4px;
    }

    .lh-title-yao {
        height: 3px;
        gap: 5px;
    }

    .lh-title-yao.is-trigram-gap {
        margin-bottom: 2px;
    }

    .lh-hex-kicker {
        font-size: 0.56rem;
    }

    .lh-hex-name {
        font-size: 0.9rem;
        line-height: 1.18;
    }

    .lh-hex-trigrams {
        font-size: 0.62rem;
        margin-top: 2px;
    }

    .lh-hex-meta {
        margin-top: 5px;
        padding-top: 5px;
        font-size: 0.64rem;
        line-height: 1.32;
        gap: 2px;
        flex-direction: column;
    }

    .lh-hex-arrow {
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 5 CỘT TỨ TRỤ + TUẦN KHÔNG NẰM GỌN 1 HÀNG NGANG TRÊN 390PX */
    .lh-pillars-strip {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }

    .lh-pillar-chip {
        min-width: 0;
        padding: 5px 2px;
        border-radius: 5px;
    }

    .lh-p-lbl {
        font-size: 0.56rem;
    }

    .lh-p-val {
        font-size: 0.72rem;
    }

    .lh-time-bar {
        gap: 8px;
        padding: 6px 0 4px;
    }

    .lh-time-meta {
        font-size: 0.74rem;
    }

    .lh-formula-strip {
        font-size: 0.67rem;
        line-height: 1.4;
        gap: 3px;
    }

    .lh-question-banner {
        padding: 9px 11px;
        margin: 8px 0;
    }

    .lh-q-text {
        font-size: 0.9rem;
    }

    .lh-q-dungthan {
        font-size: 0.73rem;
    }

    /* BẢNG 6 HÀO MOBILE CHUẨN 问真六爻 — VỪA KHÍT 100% 390PX, KHÔNG VUỐT NGANG */
    .lh-capture-wrap:not(.is-exporting) .lh-desktop-board {
        display: none;
    }

    .lh-capture-wrap:not(.is-exporting) .lh-mobile-board {
        display: block;
        border: 1px solid #bcd4e6;
        border-radius: 7px;
        overflow: hidden;
        background: #ffffff;
    }

    .lh-mb-thead {
        display: grid;
        grid-template-columns: 60px minmax(0, 1fr) 30px minmax(0, 1fr);
        gap: 5px;
        align-items: center;
        background: #0b2a4a;
        color: #ffffff;
        font-size: 0.6rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        padding: 7px 6px;
    }

    .lh-mb-row {
        border-top: 1px solid #d7e5f0;
        padding: 7px 6px 6px;
        background: #ffffff;
    }

    .lh-mb-row.is-the-row {
        background: #f5faff;
    }

    .lh-mb-row.is-moving-row {
        background: #fffcf0;
    }

    .lh-mb-row.is-dungthan-row {
        box-shadow: inset 3px 0 0 #b45309;
    }

    .lh-mb-row-top {
        display: grid;
        grid-template-columns: 60px minmax(0, 1fr) 30px minmax(0, 1fr);
        gap: 5px;
        align-items: center;
    }

    .lh-mb-hz {
        font-weight: 700;
        color: #8c5a18;
    }

    .lh-mb-c-lt {
        display: flex;
        flex-direction: column;
        line-height: 1.18;
    }

    .lh-mb-hnum {
        font-size: 0.67rem;
        font-weight: 800;
        color: #0b2a4a;
    }

    .lh-mb-lucthu {
        font-size: 0.62rem;
        font-weight: 700;
        color: #3a5772;
        word-break: break-word;
    }

    .lh-mb-c-main,
    .lh-mb-c-chg {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .lh-mb-row.is-trigram-split {
        border-bottom: 2px solid #8eb0cc;
    }

    .lh-mb-c-chg.is-static-col .lh-mb-text-line {
        opacity: 0.78;
    }

    .lh-mb-c-chg.is-dim-col {
        opacity: 0.65;
    }

    .lh-mb-yao-wrap {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .lh-yao-bar.is-mobile-bar {
        width: 58px;
        height: 9px;
        gap: 11px;
    }

    .lh-yao-bar.is-mobile-bar .lh-yao-seg {
        height: 6.5px;
        border-radius: 1px;
    }

    .lh-yao-bar.is-mobile-bar .lh-yao-seg.is-half {
        flex: 1;
    }

    .lh-mb-text-line {
        display: flex;
        align-items: baseline;
        gap: 4px;
        flex-wrap: wrap;
        line-height: 1.2;
    }

    .lh-mb-lt {
        font-size: 0.68rem;
        font-weight: 700;
        color: #1e3a57;
        white-space: nowrap;
    }

    .lh-mb-lt.is-target {
        color: #9a3412;
    }

    .lh-mb-cc {
        font-size: 0.72rem;
        font-weight: 800;
        white-space: nowrap;
    }

    .lh-mb-c-move {
        text-align: center;
    }

    .lh-move-sym.is-sm {
        width: 19px;
        height: 19px;
    }

    .lh-move-sym.is-sm svg {
        width: 17px;
        height: 17px;
    }

    .lh-mb-row-meta {
        margin-top: 5px;
        padding-top: 4px;
        border-top: 1px dashed #e5eef5;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 3px;
    }

    .lh-mb-row-meta .lh-str-badge,
    .lh-mb-row-meta .lh-stage-badge,
    .lh-mb-row-meta .lh-mini-tag {
        font-size: 0.6rem;
        padding: 1px 5px;
    }

    .lh-mb-phuc-inline {
        font-size: 0.63rem;
        color: #5b4636;
        background: #fdf7ec;
        border: 1px solid #ead8b8;
        border-radius: 4px;
        padding: 1px 6px;
        line-height: 1.3;
    }

    .lh-bottom-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .lh-thansat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .lh-star-chip {
        padding: 5px 7px;
        font-size: 0.7rem;
    }

    .mb-bottom-actions > #btnDownloadLucHao {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 44px;
    }
}


/* ==========================================================================
   LỤC HÀO V2 — FORM 4 CHẾ ĐỘ & TRANG DỊCH QUÁI ĐỐI XỨNG (CHUẨN VIỆT · TRUNG · ĐÀI)
   ========================================================================== */

/* --- 4 Tabs chọn phương pháp lập quẻ --- */
.lh-method-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.lh-method-tab {
    border: 1px solid #c3d7e8;
    border-radius: 7px;
    background: #f8fbfe;
    padding: 9px 8px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.14s ease;
    font-family: inherit;
}

.lh-method-tab:hover {
    border-color: #0b2a4a;
    background: #eef6fd;
}

.lh-method-tab.is-active {
    background: #0b2a4a;
    border-color: #0b2a4a;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(11, 42, 74, 0.22);
}

.lh-mt-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: #0b2a4a;
    line-height: 1.25;
}

.lh-mt-sub {
    font-size: 0.7rem;
    color: #5b7287;
    line-height: 1.2;
}

.lh-method-tab.is-active .lh-mt-title {
    color: #ffffff;
}

.lh-method-tab.is-active .lh-mt-sub {
    color: #f3d796;
}

.lh-method-pane {
    display: none;
    margin-top: 10px;
}

.lh-method-pane.is-active {
    display: block;
}

/* --- Tab 1: Sân gieo 3 đồng xu cổ --- */
.lh-coin-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.lh-coin-left {
    background: linear-gradient(180deg, #fffdf7 0%, #f8f1e0 100%);
    border: 1px solid #e2cfa4;
    border-radius: 8px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.lh-coin-trio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.lh-coin-disc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.28s ease;
}

.lh-coin-svg {
    width: 68px;
    height: 68px;
    filter: drop-shadow(0 3px 6px rgba(107, 70, 10, 0.28));
}

.lh-coin-disc.is-yin-face .lh-coin-svg {
    filter: drop-shadow(0 3px 6px rgba(107, 70, 10, 0.22)) brightness(0.93) saturate(0.85);
}

.lh-coin-trio.is-spinning .lh-coin-disc {
    animation: lhCoinFlip 0.34s ease-in-out;
}

@keyframes lhCoinFlip {
    0% { transform: rotateY(0deg) translateY(0); }
    50% { transform: rotateY(540deg) translateY(-10px); }
    100% { transform: rotateY(1080deg) translateY(0); }
}

.lh-coin-face-lbl {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b460a;
    background: #fff8e6;
    border: 1px solid #e3cb8e;
    border-radius: 999px;
    padding: 1px 8px;
}

.lh-coin-status {
    font-size: 0.82rem;
    color: #3a4f63;
    text-align: center;
    line-height: 1.5;
    max-width: 390px;
}

.lh-coin-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.lh-coin-preview {
    background: #ffffff;
    border: 1px solid #cbdceb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lh-coin-preview-head {
    background: #edf5fc;
    border-bottom: 1px solid #cbdceb;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.72rem;
    font-weight: 700;
    color: #164872;
}

.lh-coin-preview-head strong {
    color: #0b2a4a;
    font-size: 0.79rem;
}

.lh-coin-slots {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lh-coin-slot {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) 92px;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    background: #f8fbfe;
    border: 1px solid #e4eef7;
    font-size: 0.76rem;
}

.lh-coin-slot.is-mv {
    background: #fff5f5;
    border-color: #f3c1c1;
}

.lh-slot-pos {
    font-weight: 700;
    color: #334e68;
    white-space: nowrap;
}

.lh-slot-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 14px;
}

.lh-slot-placeholder {
    font-size: 0.72rem;
    color: #94a3b8;
    font-style: italic;
}

.lh-slot-yao {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 72px;
    height: 9px;
}

.lh-slot-yao.is-yang span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 1px;
}

.lh-slot-yao.is-yin span {
    display: block;
    width: 41%;
    height: 100%;
    border-radius: 1px;
}

.lh-slot-yao.is-blue span {
    background: #1d4e89;
}

.lh-slot-yao.is-red span {
    background: #dc2626;
}

.lh-slot-sym {
    font-style: normal;
    font-weight: 800;
    font-size: 0.85rem;
    color: #dc2626;
    line-height: 1;
}

.lh-slot-desc {
    text-align: right;
    font-weight: 600;
    color: #475569;
    font-size: 0.72rem;
    white-space: nowrap;
}

.lh-coin-slot.is-mv .lh-slot-desc {
    color: #b91c1c;
    font-weight: 700;
}

/* --- Tab 2 & 4: Nhập xu thật & Chọn trực tiếp --- */
.lh-manual-note {
    background: #f4f9fd;
    border: 1px solid #c9dfef;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.8rem;
    color: #294661;
    line-height: 1.5;
    margin-bottom: 12px;
}

.lh-manual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.lh-manual-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lh-manual-lbl {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 0.79rem;
    color: #1e3448;
}

.lh-manual-lbl strong {
    color: #0b2a4a;
}

.lh-manual-lbl span {
    font-size: 0.74rem;
    color: #5b7287;
    font-weight: 600;
}

.lh-moving-checks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.lh-mv-check-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid #c5d9e9;
    border-radius: 6px;
    background: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e3448;
    cursor: pointer;
    user-select: none;
}

.lh-mv-check-chip:has(input:checked) {
    background: #fff5f5;
    border-color: #dc2626;
    color: #b91c1c;
}

.lh-mv-check-chip input {
    accent-color: #dc2626;
    width: 15px;
    height: 15px;
    margin: 0;
}

.lh-preview-strip {
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 6px;
    background: #fffbeb;
    border: 1px solid #e6cf8f;
    font-size: 0.82rem;
    color: #4a3712;
}

/* ==========================================================================
   TRANG DỊCH QUÁI — KHUNG XUẤT ẢNH CHUẨN ĐỐI XỨNG (HOCVIENLYSO + TQ/ĐL PRO)
   ========================================================================== */
.tdq-sheet {
    padding: 18px 20px 14px;
    background: #ffffff;
    border: 1px solid #b5cfe3;
    border-radius: 6px;
    color: #111827;
}

.tdq-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid #cbd8e6;
}

.tdq-header-left {
    flex: 1 1 auto;
    min-width: 0;
}

.tdq-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tdq-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

.tdq-main-title {
    margin: 0;
    font-size: 1.14rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #0b2a4a;
    line-height: 1.15;
}

.tdq-brand-sub {
    font-size: 0.7rem;
    font-weight: 600;
    color: #5b7287;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-top: 2px;
}

.tdq-info-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #1f2937;
}

.tdq-info-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.tdq-info-k {
    min-width: 126px;
    color: #475569;
    font-weight: 600;
    flex-shrink: 0;
}

.tdq-info-k-inline {
    color: #475569;
    font-weight: 600;
}

.tdq-info-v {
    color: #0f172a;
}

.tdq-emph {
    color: #0b2a4a;
}

.tdq-info-triple {
    gap: 6px 18px;
}

.tdq-khong-txt {
    color: #b45309;
}

.tdq-rat-note {
    font-size: 0.75rem;
    color: #b45309;
    font-weight: 600;
}

.tdq-method-mv {
    color: #b91c1c;
    font-weight: 700;
    margin-left: 3px;
}

.tdq-question-val {
    color: #6b21a8;
    font-weight: 700;
}

.tdq-person-tag {
    color: #475569;
    font-weight: 500;
    margin-left: 4px;
}

.tdq-coins-deco {
    width: 132px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 4px;
}

.tdq-coins-svg {
    width: 126px;
    height: auto;
    filter: drop-shadow(0 3px 6px rgba(98, 65, 12, 0.2));
}

/* --- 2 Quẻ tượng lớn đối xứng --- */
.tdq-hex-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1.5px solid #cbd8e6;
}

.tdq-hex-pair.is-single {
    grid-template-columns: minmax(0, 1fr);
}

.tdq-hex-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.tdq-hex-col.is-right {
    border-left: 1px solid #d1deea;
}

.tdq-hex-name-bar {
    text-align: center;
    padding: 8px 10px;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #6b2152;
    border-bottom: 1px solid #e2ebf3;
    background: #fcfdfe;
}

.tdq-hex-figure-wrap {
    padding: 12px 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.tdq-big-hex {
    width: 108px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tdq-big-yao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 11px;
    width: 100%;
}

.tdq-big-yao.is-split {
    margin-bottom: 3px;
}

.tdq-big-yao.is-yang span {
    display: block;
    width: 100%;
    height: 100%;
    background: #1d4e89;
    border-radius: 1px;
}

.tdq-big-yao.is-yin span {
    display: block;
    width: 42%;
    height: 100%;
    background: #1d4e89;
    border-radius: 1px;
}

.tdq-big-yao.is-mv span {
    background: #dc2626;
}

.tdq-palace-sub {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #64748b;
    text-align: center;
    margin-top: 2px;
}

.tdq-spec-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.tdq-spec-pill {
    font-size: 0.67rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}

.tdq-spec-pill.is-good { background: #dcfce7; color: #166534; }
.tdq-spec-pill.is-warn { background: #fef3c7; color: #92400e; }
.tdq-spec-pill.is-info { background: #e0f2fe; color: #075985; }
.tdq-spec-pill.is-danger { background: #fee2e2; color: #b91c1c; }

.tdq-motto-bar {
    text-align: center;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #0b2a4a;
    border-top: 1px solid #e2ebf3;
    background: #f6fafe;
}

/* --- Bảng 1 (An Quẻ đối xứng) & Bảng 2 (Chiếu Vượng Suy & Thần Sát từng hào) --- */
.tdq-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tdq-star-wrap {
    margin-top: 10px;
    border-top: 1.5px solid #cbd8e6;
}

.tdq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.81rem;
    font-variant-numeric: tabular-nums;
}

.tdq-table th {
    background: #edf5fc;
    color: #0b2a4a;
    font-weight: 700;
    font-size: 0.74rem;
    text-align: left;
    padding: 6px 7px;
    border-bottom: 1.5px solid #b5cfe3;
    white-space: nowrap;
}

.tdq-table td {
    padding: 6px 7px;
    border-bottom: 1px solid #e4edf5;
    vertical-align: middle;
    white-space: nowrap;
}

.tdq-row.is-trigram-sep td {
    border-bottom: 1.5px solid #b5cfe3;
}

.tdq-row.is-mv-row {
    background: #fff9f9;
}

.tdq-mid-sep {
    border-left: 1.5px solid #bfd3e4 !important;
    padding-left: 10px !important;
}

.tdq-an-table th.col-yao,
.tdq-an-table td.col-yao {
    width: 60px;
    text-align: center;
}

.tdq-an-table th.col-tu,
.tdq-an-table td.col-tu {
    width: 38px;
    text-align: center;
}

.tdq-an-table th.col-tk,
.tdq-an-table td.col-tk {
    width: 30px;
    text-align: center;
}

.tdq-inline-yao-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tdq-mini-yao {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 42px;
    height: 7px;
}

.tdq-mini-yao.is-yang span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 1px;
}

.tdq-mini-yao.is-yin span {
    display: block;
    width: 41%;
    height: 100%;
    border-radius: 1px;
}

.tdq-mini-yao.is-blue span { background: #1d4e89; }
.tdq-mini-yao.is-red span { background: #dc2626; }

.tdq-mv-dot {
    font-size: 0.78rem;
    font-weight: 800;
    color: #dc2626;
    line-height: 1;
}

.tdq-tu-the {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
}

.tdq-tu-ung {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    background: #eef4fa;
    color: #334e68;
    font-size: 0.7rem;
    font-weight: 700;
}

.tdq-txt-main {
    color: #1e293b;
    font-weight: 600;
}

.tdq-txt-red {
    color: #c81e1e;
    font-weight: 600;
}

.tdq-txt-red-bold {
    color: #c81e1e;
    font-weight: 800;
}

.tdq-dt-star {
    color: #d97706;
    margin-right: 2px;
}

.tdq-phuc-txt {
    color: #9a3412;
    font-weight: 600;
    font-size: 0.76rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    padding: 1px 5px;
}

.tdq-k-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #fef3c7;
    color: #b91c1c;
    font-size: 0.74rem;
    font-weight: 800;
}

.tdq-star-table th.col-vs,
.tdq-star-table td.col-vs {
    text-align: left;
    min-width: 52px;
}

.tdq-star-table th.col-star,
.tdq-star-table td.col-star {
    text-align: center;
    min-width: 34px;
}

.tdq-cc-full {
    font-weight: 700 !important;
}

.tdq-mark-qt {
    color: #0b2a4a;
    background: #e0f2fe;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.tdq-mark-star {
    color: #b91c1c;
    font-weight: 800;
    font-size: 0.79rem;
}

.tdq-dash {
    color: #cbd5e1;
}

/* --- Thẻ thu gọn chuyên sâu ngoài khung ảnh --- */
.tdq-deep-table td,
.tdq-deep-table th {
    padding: 8px 10px;
    font-size: 0.8rem;
}

.tdq-deep-mv {
    background: #fff8f8;
}

.tdq-tag-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.tdq-lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.tdq-lore-box {
    background: #f8fbfe;
    border: 1px solid #d4e3f0;
    border-radius: 7px;
    padding: 12px 14px;
}

.tdq-lore-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4b657c;
    margin-bottom: 3px;
}

.tdq-lore-motto {
    font-size: 0.96rem;
    font-weight: 800;
    color: #0b2a4a;
    margin-bottom: 5px;
}

.tdq-lore-text {
    margin: 0;
    font-size: 0.83rem;
    color: #334e68;
    line-height: 1.55;
}

/* --- Responsive Mobile cho Form 4 chế độ & Trang Dịch Quái --- */
@media (max-width: 768px) {
    .lh-method-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lh-coin-stage {
        grid-template-columns: 1fr;
    }

    .lh-manual-grid {
        grid-template-columns: 1fr;
    }

    .lh-moving-checks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tdq-sheet:not(.is-exporting) {
        padding: 12px 10px 10px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-header {
        flex-direction: column;
        gap: 10px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-coins-deco {
        display: none;
    }

    .tdq-sheet:not(.is-exporting) .tdq-info-k {
        min-width: auto;
    }

    .tdq-sheet:not(.is-exporting) .tdq-info-list {
        font-size: 0.78rem;
    }

    .tdq-sheet:not(.is-exporting) .tdq-hex-name-bar {
        font-size: 0.82rem;
        padding: 6px 4px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-big-hex {
        width: 82px;
        gap: 4px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-big-yao {
        height: 9px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-motto-bar {
        font-size: 0.7rem;
        padding: 5px 4px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-table {
        font-size: 0.72rem;
    }

    .tdq-sheet:not(.is-exporting) .tdq-table th,
    .tdq-sheet:not(.is-exporting) .tdq-table td {
        padding: 5px 4px;
    }

    .tdq-sheet:not(.is-exporting) .tdq-mini-yao {
        width: 30px;
        height: 6px;
    }
}


/* ==========================================================================
   KHUNG ĐẾM NGƯỢC THEO BẬC THANG & BANNER QUẢNG CÁO (FREE COOLDOWN GATE)
   ========================================================================== */
.cdg-box {
    background: #ffffff;
    border: 1px solid #d5e2ee;
    border-radius: 10px;
    padding: 20px 22px;
    box-shadow: 0 4px 18px rgba(11, 42, 74, 0.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cdg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.cdg-top-left {
    flex: 1 1 340px;
    min-width: 0;
}

.cdg-title {
    margin: 9px 0 6px;
    font-size: 1.2rem;
    line-height: 1.32;
    color: #0b2a4a;
}

.cdg-sub {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.55;
}

.cdg-clock-card {
    flex: 0 0 215px;
    background: linear-gradient(155deg, #0b2a4a 0%, #143f6b 100%);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(11, 42, 74, 0.22);
}

.cdg-clock-card.is-ready {
    background: linear-gradient(155deg, #166534 0%, #15803d 100%);
}

.cdg-clock-lbl {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #cbd5e1;
}

.cdg-clock-time {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #f6d583;
    line-height: 1.15;
    margin: 4px 0 8px;
    font-variant-numeric: tabular-nums;
}

.cdg-clock-card.is-ready .cdg-clock-time {
    color: #ffffff;
}

.cdg-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.cdg-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #e2ae45 0%, #f7da8a 100%);
    transition: width 0.45s linear;
}

/* Banner Quảng cáo / Tài trợ */
.cdg-ad-card {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fffdf7 0%, #f8f0dc 100%);
    border: 1px solid #e4cfa0;
    border-radius: 9px;
    padding: 15px 17px;
}

.cdg-ad-media {
    flex: 0 0 230px;
    max-width: 100%;
}

.cdg-ad-media img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid #e5d4ad;
    display: block;
}

.cdg-ad-content {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cdg-ad-badge {
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 9px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #e9cb7e;
}

.cdg-ad-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: #0b2a4a;
    line-height: 1.35;
}

.cdg-ad-body {
    margin: 0;
    font-size: 0.84rem;
    color: #3a4f63;
    line-height: 1.52;
}

.cdg-ad-cta {
    align-self: flex-start;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    border-radius: 6px;
    background: #0b2a4a;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.14s ease;
}

.cdg-ad-cta:hover {
    background: #164473;
}

.cdg-ad-html {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.cdg-ad-html-lbl {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 6px;
}

/* Mẹo kiến thức ngắn trong lúc chờ */
.cdg-tip-box {
    background: #f2f8fd;
    border: 1px solid #cce0f0;
    border-left: 3.5px solid #16598f;
    border-radius: 7px;
    padding: 11px 14px;
}

.cdg-tip-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0b2a4a;
    margin-bottom: 3px;
}

.cdg-tip-text {
    margin: 0;
    font-size: 0.81rem;
    color: #334e68;
    line-height: 1.5;
}

/* Thanh nút hành động */
.cdg-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cdg-unlock-btn {
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: not-allowed;
    font-variant-numeric: tabular-nums;
}

.cdg-unlock-btn.is-ready {
    background: #15803d;
    border-color: #166534;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.28);
}

.cdg-pro-btn {
    text-decoration: none;
}

.cdg-back-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Banner xanh khi đã mở khóa form */
.cdg-unlocked-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 0.84rem;
    color: #14532d;
}

.cdg-unlocked-bar strong {
    color: #166534;
    margin-right: 4px;
}

.cdg-unlocked-bar span {
    color: #15803d;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .cdg-box {
        padding: 15px 13px;
        gap: 13px;
    }

    .cdg-clock-card {
        flex: 1 1 100%;
    }

    .cdg-ad-media {
        flex: 1 1 100%;
    }

    .cdg-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cdg-unlock-btn,
    .cdg-pro-btn,
    .cdg-back-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
