/* Shared typography and layout rules for the existing Bayer interface. */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/be-vietnam-pro/be-vietnam-pro-400.woff") format("woff"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/be-vietnam-pro/be-vietnam-pro-500.woff") format("woff"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/be-vietnam-pro/be-vietnam-pro-600.woff") format("woff"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/be-vietnam-pro/be-vietnam-pro-700.woff") format("woff"); }

html { scrollbar-gutter: stable; }
html:has(body.admin-shell) { scrollbar-gutter: auto; }
html:has(body.public-shell) { scrollbar-gutter: auto; background: #f7fbf4; }
body.bayer-theme { font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif; font-synthesis: none; line-height: 1.6; }
.bayer-theme :where(button, input, select, textarea) { font-family: inherit; }
.bayer-theme :where(main, section, article, aside, header, footer, form, fieldset) { min-width: 0; }
.bayer-theme :where(h1, h2, h3, h4) { line-height: 1.35; letter-spacing: -.025em; text-wrap: pretty; }
.bayer-theme :where(p, label) { overflow-wrap: anywhere; }
.bayer-theme :where(input, select, textarea)::placeholder { color: #89988d; font-weight: 400; }
.bayer-theme :where(button, a, input, select, textarea):focus-visible { outline: 2px solid #73a860; outline-offset: 3px; }
.bayer-theme :where(button, input, select, textarea) { -webkit-tap-highlight-color: transparent; }
.bayer-theme :where(button:not(:disabled), a[href], select) { touch-action: manipulation; }
.bayer-theme :where(button:disabled) { cursor: default; }
.bayer-theme .font-black, .bayer-theme .font-extrabold { font-weight: 700; }
.bayer-theme :where(table, time, [id$="Count"]) { font-variant-numeric: tabular-nums; }
.bayer-theme :where(th) { letter-spacing: .025em; }
.bayer-theme .shadow-sm { box-shadow: 0 2px 10px rgb(27 68 34 / .04) !important; }
.bayer-theme :where([hidden]) { display: none !important; }
.bayer-theme :where(.overflow-y-auto, .overflow-auto) { scrollbar-width: thin; scrollbar-color: #b7cdb0 transparent; }

/* Predictable workspace sizes; scrolling belongs to content, not the shell. */
.admin-shell, .admin-root { height: 100dvh; }
.admin-shell { font-size: 14px; }
.admin-sidebar { min-height: 0; }
.admin-sidebar h1 { font-size: 1rem; line-height: 1.5; }
.admin-sidebar__link { font-weight: 500; }
.bayer-theme--admin .admin-sidebar nav .admin-sidebar__link:not(.is-active):not(.admin-sidebar__link--logout):hover { transform: none; }
.admin-sidebar__account-label { line-height: 1.6; }
.admin-sidebar__account { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.programs-header > div { gap: 1.25rem; padding: 1.25rem 1.5rem; }
.programs-header h2 { font-size: 1.5rem; }
.programs-header p { max-width: 55ch; font-size: .8125rem; line-height: 1.7; }
.programs-header #openProgramModal { flex-shrink: 0; min-height: 44px; white-space: nowrap; }
.programs-workspace { padding: 1.25rem 1.5rem; }
#programFilters :where(input, select) { min-height: 44px; font-size: .875rem; }
#programResults table { width: 100%; min-width: 54rem; }
#programResults th { font-size: .6875rem; font-weight: 600; }
#programResults td { vertical-align: middle; padding: 1rem; }
#programResults td:nth-child(2) { min-width: 15rem; max-width: 30rem; overflow-wrap: anywhere; }
#programResults td:nth-child(3), #programResults td:nth-child(4) { white-space: nowrap; }
#programResults td:last-child > div { flex-wrap: wrap; }
#programResults td:last-child :where(a, button) { white-space: nowrap; }
#programResults[aria-busy="true"] { cursor: progress; }
.program-editor-header__row h2 { font-size: 1.125rem; white-space: nowrap; text-wrap: nowrap; }
.program-edit-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; min-height: 70px; }
.program-edit-actions #openPublicPreviewButton { grid-column: 1; justify-self: start; }
.program-edit-actions > a { grid-column: 2; }
.program-edit-actions > button[type="submit"] { grid-column: 3; }
.program-edit-actions > :where(a, button) { min-height: 40px; white-space: nowrap; }
.admin-login-page { overflow-y: auto; }
.admin-login-card { flex-shrink: 0; margin-block: auto; }
.admin-media-editor > div { max-height: calc(100dvh - 2rem); }
.admin-media-editor [data-media-editor-stage] { min-height: clamp(12rem, 42dvh, 24rem) !important; }
.admin-media-editor[data-media-type="logo"] [data-media-editor-frame] { width: min(100%, 36dvh) !important; }
.program-tabs__link { font-weight: 600; letter-spacing: 0; }
.program-tabs__link span { min-width: 0; }
#programEditWorkspace, #createProgramWorkspace { scrollbar-gutter: stable; }
.admin-shell [data-edit-section]:not([hidden]) { animation: none; }
.admin-shell :where(.chat-thread__messages, .chat-inbox__list) { scrollbar-gutter: stable; }
.admin-shell .results-main { overflow: hidden; scrollbar-gutter: auto; }
.results-workspace { overflow-y: auto; }
.results-data-table th { font-size: .6875rem; font-weight: 600; }
.results-data-table td { font-size: .8125rem; }
.published-search-summary { min-height: 1.5em; }
#clearPublishedSearch { display: block !important; }
#clearPublishedSearch.hidden { visibility: hidden; pointer-events: none; }
.chat-admin__topbar h2 { font-size: 1.375rem; }
.chat-thread__identity h3 { font-size: .9375rem; }
.chat-message__bubble, .admin-message__bubble { font-size: .875rem; line-height: 1.65; }
.chat-conversation__name { line-height: 1.6; }
.chat-program-picker__options button { min-height: 48px; }

/* Public pages share a readable content width and calmer hierarchy. */
.public-shell { font-size: 15px; }
.public-main { width: min(100%, 1280px); }
.public-header__title-text { letter-spacing: -.02em; }
.home-title { font-size: clamp(1.125rem, 1.6vw, 1.375rem); font-weight: 700; line-height: 1.4; }
.home-eyebrow, .program-card__label { font-size: .6875rem; font-weight: 600; }
.home-subtitle { min-height: 1.5em; font-size: .8125rem; line-height: 1.5; font-weight: 400; }
.home-search input, .home-sort select { height: 46px; font-size: .875rem; font-weight: 400; }
.home-empty { min-height: 13rem; }
.program-tab-stage { min-height: min(36rem, 75dvh); }
.program-tabs .tab-button { min-height: 44px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: transparent; font-weight: 600; }
.program-tabs .tab-button[aria-selected="true"] { border-bottom-color: #348f1d; }
.lookup-heading h2 { font-size: clamp(1.125rem, 1.7vw, 1.375rem); line-height: 1.5; }
.lookup-controls { align-items: start; }
.lookup-controls > div { min-width: 0; }
.lookup-controls :where(select, #searchInput) { min-width: 0; min-height: 44px; }
.lookup-controls #searchStatus { min-height: 3em; max-height: 3em; overflow: hidden; font-size: .75rem; line-height: 1.5; }
#clearSearchButton { display: flex !important; visibility: visible; min-width: 40px; }
#clearSearchButton.hidden { visibility: hidden; pointer-events: none; }
.lookup-results { height: clamp(22rem, 56dvh, 42rem); min-height: 0; }
.lookup-results > div:first-child { flex: 0 0 auto; min-height: 48px; gap: 12px; }
.lookup-results #resultTableWrap { flex: 1 1 0%; min-height: 0; max-height: none; }
.lookup-results :where(#loadingState, #emptyState, #errorState):not(.hidden) { display: flex; flex: 1 1 0%; min-height: 0; align-items: center; justify-content: center; }
.result-table th { font-size: .6875rem; font-weight: 600; }
.result-table td { font-size: .8125rem; line-height: 1.65; }
.program-document, .program-pdf-card { box-shadow: 0 3px 14px rgb(30 83 35 / .045); }
.public-footer__inner { padding-right: 5.5rem; }

@media (min-width: 768px) and (max-width: 1100px) {
    .home-toolbar { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .home-controls { margin-top: 0; }
    .program-editor-header .program-tabs__track { min-width: 0; width: 100%; }
    .program-editor-header .program-tabs__link { padding: .5rem; white-space: normal; font-size: .6875rem; line-height: 1.5; }
}

@media (max-width: 767px) {
    html { scrollbar-gutter: auto; }
    .bayer-theme :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) { font-size: 16px; }
    .admin-sidebar nav { flex: 1 1 0%; width: auto; }
    .admin-sidebar nav .admin-sidebar__link { min-width: 0; flex: 1 1 0%; padding: .6rem .4rem; font-size: .6875rem; }
    .admin-sidebar nav .admin-sidebar__link > span:first-child { overflow: hidden; text-overflow: ellipsis; }
    .admin-sidebar__account { padding: .45rem; }
    .admin-sidebar__account .admin-sidebar__link--logout { width: 40px; justify-content: center; }
    .admin-sidebar__logout-text { display: none; }
    .programs-header > div { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
    .programs-header h2 { font-size: 1.25rem; }
    .programs-header #openProgramModal { align-self: flex-start; padding-block: .6rem; }
    .programs-workspace { padding: 16px; }
    .program-filters-grid { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
    .program-filters-grid > div:first-child { grid-column: 1 / -1; }
    #programFilters { padding: 12px; }
    #programResults { background: transparent; border: 0; box-shadow: none !important; }
    #programResults table, #programResults tbody { display: block; min-width: 0; width: 100%; }
    #programResults thead { display: none; }
    #programResults tbody { display: grid; gap: 12px; border: 0; background: transparent; }
    #programResults tr { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px 12px; border: 1px solid #dce7d5; border-radius: 12px; padding: 14px; background: #fff; }
    #programResults td { min-width: 0; max-width: none; padding: 0; border: 0; }
    #programResults td:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
    #programResults td:nth-child(2) { min-width: 0; grid-column: 2; grid-row: 1; }
    #programResults td:nth-child(2) > p:first-child { font-size: .875rem; line-height: 1.6; }
    #programResults td:nth-child(3) { grid-column: 2; grid-row: 2; }
    #programResults td:nth-child(4) { grid-column: 1 / -1; font-size: .75rem; color: #73806e; }
    #programResults td:nth-child(4)::before { content: "Ngày tạo: "; }
    #programResults td:nth-child(5) { grid-column: 1 / -1; border-top: 1px solid #edf2e8; padding-top: 10px; }
    #programResults td:last-child > div { justify-content: flex-start; gap: 6px; }
    #programResults td:last-child :where(a, button) { min-height: 38px; padding: 8px 9px; font-size: .75rem; }
    #programResults td[colspan] { grid-column: 1 / -1; padding: 24px 12px; text-align: center; }
    .program-editor-header .program-tabs { overflow: visible; padding: .5rem 1rem; }
    .program-editor-header .program-tabs__track { min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
    .program-editor-header .program-tabs__link { min-height: 42px; padding: .5rem; white-space: normal; font-size: .6875rem; }
    .program-editor-header__row h2 { font-size: 1rem; }
    .program-edit-actions { min-height: 64px; padding: 10px 8px; gap: 6px; }
    .program-edit-actions > :where(a, button) { padding: 8px 9px; font-size: .6875rem; }
    .program-edit-actions #openPublicPreviewButton { gap: 4px; }
    .admin-login-card { padding: 24px; }
    .admin-media-editor > div > div:last-child { flex-wrap: nowrap; gap: 6px; padding: 10px; }
    .admin-media-editor > div > div:last-child button { padding: 8px; font-size: .6875rem; white-space: nowrap; }
    .home-controls { grid-template-columns: minmax(0, 1fr) 8rem; gap: 8px; }
    .home-main { padding-inline: 12px; }
    .public-footer__inner { padding-right: 5rem; }
    .public-header__title-text { font-size: .875rem !important; }
    .program-tab-stage { padding: 12px; }
    .lookup-controls { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .lookup-heading h2 { font-size: 1.0625rem; text-transform: none; }
    .lookup-results { height: clamp(22rem, 55dvh, 34rem); }
    .chat-admin__topbar h2 { font-size: 1rem; }
    .chat-admin__topbar { padding-inline: 12px; }
    .chat-thread__identity { flex-basis: 120px; }
    .chat-thread__identity h3 { font-size: .875rem; }
    .chat-thread__identity p { font-size: .625rem; }
    .chat-thread__resolve, .chat-thread__action-btn { font-size: .6875rem; }
}

@media (max-height: 640px) {
    .admin-login-page { align-items: flex-start; padding-block: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .bayer-theme *, .bayer-theme *::before, .bayer-theme *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}


.program-entry[hidden] { display: none; }

/* Banner cards keep their artwork ratio; identity and actions sit over the image. */
.program-list { grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 768px) { .program-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.program-list[data-visible-count="1"] { grid-template-columns: minmax(0, 760px); justify-content: center; }
.bayer-theme .home-main::before, .bayer-theme .home-main::after { content: none; }
.program-card {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border: 1px solid #d5e4cd;
    border-radius: 14px;
    background: #eaf2e4;
}
.program-card__media { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; }
.program-card__banner { position: absolute; inset: 0; width: 100%; height: 100%; }
.program-card__fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #07552f, #58a91e); color: #fff; font-weight: 700; }
.program-card__toggle { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; padding: 0; background: transparent; cursor: pointer; }
.program-card__toggle:focus-visible { outline: 3px solid #bade72; outline-offset: -5px; }
.program-card__identity { position: absolute; inset: auto 0 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 28px 14px 14px; background: linear-gradient(transparent, rgb(0 35 20 / .84)); pointer-events: none; transition: opacity .18s ease; }
.program-card.is-revealed .program-card__identity { opacity: 0; }
.program-card__logo { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 64px; height: 64px; overflow: hidden; border: 2px solid #fff; border-radius: 50%; background: #fff; color: #267d1b; font-size: 22px; font-weight: 700; }
.program-card__logo img { width: 100%; height: 100%; }
.program-card__text { min-width: 0; }
.bayer-theme .program-card .program-card__title { margin: 0; color: #fff; font-size: 16px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.program-card__lookup-title { margin: 3px 0 0; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.program-card__lookup-title:empty { display: none; }
.program-card__overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgb(0 30 18 / .48); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .18s ease; }
.program-card.is-interactive .program-card__overlay { opacity: 0; visibility: hidden; }
.program-card.is-revealed .program-card__overlay { opacity: 1; visibility: visible; }
.program-card__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 12px; pointer-events: auto; }
.program-card__button { display: inline-flex; align-items: center; justify-content: center; min-width: 120px; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 9px; font-size: 13px; font-weight: 700; line-height: 1.4; text-decoration: none; text-transform: uppercase; box-shadow: 0 3px 12px rgb(0 0 0 / .12); }
.program-card__button[hidden] { display: none; }
.bayer-theme .program-card .program-card__button--ghost { border-color: #fff; background: #fff; color: #07552f; }
.bayer-theme .program-card .program-card__button--primary { border-color: #267d1b; background: #267d1b; color: #fff; }
.program-card__button:hover { filter: brightness(.94); }
.program-card__button:focus-visible { outline: 3px solid #bade72; outline-offset: 3px; }
.program-card__touch-hint { display: none; }
@media (max-width: 480px) {
    .program-card__identity { gap: 9px; padding: 24px 10px 10px; }
    .program-card__logo { width: 48px; height: 48px; }
    .bayer-theme .program-card .program-card__title { font-size: 14px; }
    .program-card__lookup-title { font-size: 11px; }
    .program-card__button { min-width: 112px; padding-inline: 12px; font-size: 12px; }
}
@media (hover: none) {
    .program-card__touch-hint { position: absolute; top: 10px; right: 10px; display: block; border-radius: 999px; padding: 6px 10px; background: rgb(0 35 20 / .7); color: #fff; font: 500 11px / 1.4 "Be Vietnam Pro", sans-serif; }
    .program-card.is-revealed .program-card__touch-hint { opacity: 0; }
}

.home-main .program-viewport { max-height: none; overflow: visible; padding: 0; }
html:has(.home-main) { scrollbar-width: thin; scrollbar-color: #78a963 #f7fbf4; }

/* One typography hierarchy across the public panels and admin editor tabs. */
.public-detail-main .program-panel-title {
    margin: 0;
    color: #07552f;
    font-size: clamp(1.125rem, 1.7vw, 1.375rem);
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: -.015em;
    text-transform: none;
    overflow-wrap: anywhere;
}
.program-document-panel > .program-panel-title { margin-bottom: 12px; }
.program-editor-section-title { margin: 0; color: #07552f; font-size: 1rem; font-weight: 700; line-height: 1.5; }
