
/* ===== STYLE FULL FIX ALL PAGES ===== */
*{box-sizing:border-box;margin:0;padding:0}

html,body{
    font-family:'Aptos','Segoe UI Variable Text','Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
    font-size:16px;
    line-height:1.6;
    background:#f4f7fb;
    color:#1f2f45;
    text-rendering:optimizeLegibility;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
}

img{max-width:100%;height:auto;display:block}
a{color:#0d63ae;text-decoration:none}
a:hover{color:#1a73e8}
.container{max-width:1200px;margin:0 auto;padding:0 16px}
.page-content,.page-shell{padding:24px 0}
.site-footer{text-align:center;padding:20px 0;color:#64748b}

/* ===== HEADER ===== */
.site-header{
    background:#fff;
    border-bottom:1px solid #dce4ef;
    position:sticky;
    top:0;
    z-index:999;
    box-shadow:0 8px 20px rgba(16,47,97,.05);
}

.header-inner,
.site-header__inner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    padding:14px 0;
}

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

.brand img,
.site-brand__logo{
    width:60px;
    height:60px;
    max-width:60px;
    max-height:60px;
    object-fit:contain;
    flex:0 0 60px;
}

.brand-text,
.site-brand__text{
    display:flex;
    flex-direction:column;
    justify-content:center;
    min-width:0;
}

.brand-title,
.site-brand__title{
    font-size:20px;
    font-weight:800;
    color:#0b4f92;
    line-height:1.2;
}

.brand-subtitle,
.site-brand__subtitle{
    font-size:14px;
    font-weight:700;
    color:#15803d;
    line-height:1.2;
    margin-top:4px;
}

.header-right{
    display:flex;
    align-items:center;
    gap:12px;
    flex:1;
    justify-content:flex-end;
    min-width:0;
}

.main-nav,
.site-nav{
    display:flex;
    align-items:center;
    gap:10px;
    white-space:nowrap;
    margin-left:auto;
}

.main-nav a,
.site-nav a{
    padding:8px 12px;
    font-weight:600;
    border-radius:10px;
}

.main-nav a:hover,
.site-nav a:hover{
    background:#eef6ff;
}

.main-nav a.active,
.site-nav a.active,
.main-nav a.is-active,
.site-nav a.is-active{
    background:#0d63ae;
    color:#fff;
}

.mobile-menu-toggle{
    display:none;
    width:42px;
    height:42px;
    border:1px solid #d6e0ea;
    border-radius:10px;
    background:#fff;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:5px;
    cursor:pointer;
}
.mobile-menu-toggle span{
    display:block;
    width:18px;
    height:2px;
    background:#1f3f68;
    transition:all .2s ease;
}
.mobile-menu-toggle.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.mobile-menu-toggle.open span:nth-child(2){opacity:0}
.mobile-menu-toggle.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

/* ===== SEARCH ===== */
.search-toggle-wrap{
    position:relative;
    display:flex;
    align-items:center;
    flex:0 0 auto;
    margin-left:6px;
}
.site-search-btn,
.search-icon-btn{
    width:32px;
    height:32px;
    border:none;
    border-radius:8px;
    background:#0d63ae;
    color:#fff;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:0 6px 14px rgba(13,99,174,.18);
    text-decoration:none;
}
.search-icon-btn svg,
.header-search-pop button svg{
    width:16px;
    height:16px;
}
.header-search-pop{
    position:absolute;
    top:42px;
    right:0;
    width:320px;
    max-width:calc(100vw - 32px);
    display:none;
    align-items:center;
    gap:8px;
    background:#fff;
    padding:8px;
    border-radius:10px;
    border:1px solid #dce4ef;
    box-shadow:0 10px 25px rgba(0,0,0,.1);
    z-index:1000;
}
.search-toggle-wrap.open .header-search-pop{display:flex}
.header-search-pop input{
    flex:1;
    min-width:0;
    padding:10px;
    border:1px solid #dce4ef;
    border-radius:8px;
    outline:none;
    background:#fff;
}
.header-search-pop button{
    width:34px;
    height:34px;
    border:none;
    background:#0d63ae;
    color:#fff;
    border-radius:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

/* ===== ADMIN AVATAR ===== */
.user-dropdown{position:relative;flex:0 0 auto}
.user-avatar-btn{
    width:34px;
    height:34px;
    border:none;
    background:transparent;
    padding:0;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.user-avatar-circle{
    width:34px;
    height:34px;
    border-radius:50%;
    overflow:hidden;
    display:block;
    border:2px solid #d9e2ef;
    background:#fff;
}
.user-avatar-circle img{
    width:100%;
    height:100%;
    object-fit:cover;
}
.user-dropdown-menu{
    position:absolute;
    top:44px;
    right:0;
    width:380px;
    max-width:min(92vw, 380px);
    max-height:72vh;
    overflow:auto;
    background:#fff;
    border:1px solid #dce4ef;
    border-radius:18px;
    box-shadow:0 16px 40px rgba(16,47,97,.16);
    padding:10px 0 12px;
    display:none;
    z-index:9999;
}
.user-dropdown.open .user-dropdown-menu{display:block}
.user-dropdown-header{
    padding:14px 16px 10px;
    border-bottom:1px solid #edf2f7;
    margin-bottom:6px;
}
.user-name{font-size:16px;font-weight:700;color:#102f61;margin-bottom:4px}
.user-username{font-size:13px;color:#6b7280}
.user-account-row{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}
.inline-logout-form{
    display:inline-flex;
    margin:0;
    padding:0;
}
.inline-logout-link{
    appearance:none;
    border:0;
    background:transparent;
    padding:0;
    margin:0;
    color:#b42318;
    font:inherit;
    font-size:13px;
    font-weight:700;
    line-height:1.25;
    cursor:pointer;
    text-decoration:none;
}
.inline-logout-link:hover{
    color:#8f1d14;
    text-decoration:underline;
}
.inline-logout-link:focus-visible{
    outline:2px solid #b42318;
    outline-offset:3px;
    border-radius:2px;
}
.dropdown-item{
    display:block;
    width:100%;
    padding:12px 16px;
    color:#172033;
    background:transparent;
    border:none;
    text-align:left;
    font-size:14px;
    cursor:pointer;
}
.dropdown-item:hover{background:#f4f7fb}
.logout-btn{color:#b42318}
.dropdown-logout-form{margin:0}

/* ===== COMMON UI ===== */
h1,h2,h3,h4{line-height:1.3;color:#1a2f4c}
h2{font-size:22px;font-weight:800}
h3{font-size:18px;font-weight:800}
.small{font-size:13px}
.muted{color:#64748b}
.empty{text-align:center;padding:30px}

.hero{
    background:linear-gradient(135deg,#123f7b,#1f66b3);
    color:#fff;
    border-radius:18px;
    padding:24px;
    margin-bottom:20px;
}
.hero h2{margin:0 0 10px;font-size:30px;color:#fff}
.hero p{margin:0;max-width:760px;line-height:1.6}

.card{
    background:#fff;
    border:1px solid #dce4ef;
    border-radius:18px;
    box-shadow:0 8px 20px rgba(16,47,97,.06);
    margin-bottom:20px;
}
.filter-card,.form-card,.login-card,.module-card{padding:20px}

.panel-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:16px 20px;
    border-bottom:1px solid #dce4ef;
    gap:10px;
}
.badge{
    display:inline-block;
    background:#e3f0ff;
    color:#0d4d87;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}

.filter-grid{
    display:grid;
    grid-template-columns:2fr 1fr 1fr 1fr;
    gap:16px;
    align-items:end;
}
.news-filter{
    display:grid;
    grid-template-columns:2fr auto;
    gap:16px;
    align-items:end;
}
.form-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}
.form-stack{display:grid;gap:14px}
.span-2{grid-column:span 2}

.field label{
    display:block;
    font-size:14px;
    font-weight:700;
    margin-bottom:8px;
}
.field input,.field select,.field textarea{
    width:100%;
    padding:12px 14px;
    border:1px solid #c7d3e0;
    border-radius:12px;
    font-size:14px;
    background:#fff;
    color:#1f2f45;
}
.field textarea{min-height:120px;resize:vertical}

.actions-row,.toolbar-actions,.inline-actions,.admin-toolbar{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
}
.admin-toolbar{justify-content:space-between;gap:18px}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:11px 16px;
    border-radius:12px;
    border:none;
    cursor:pointer;
    font-weight:700;
    text-decoration:none;
}
.btn-primary{background:#0d63ae;color:#fff}
.btn-light{background:#edf3fa;color:#173159}
.btn-danger{background:#c73737;color:#fff}
.small-btn{padding:8px 12px;font-size:13px}

.alert{padding:12px 14px;border-radius:12px;margin-bottom:14px}
.alert.success,.alert-success{background:#e8fff1;color:#146534}
.alert.error,.alert-error{background:#fff0f0;color:#a22323}

/* ===== TABLES ===== */
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;min-width:900px}
th,td{
    padding:14px 12px;
    border-bottom:1px solid #e3ebf5;
    text-align:left;
    vertical-align:top;
    font-size:14px;
}
th{
    background:#f8fbff;
    color:#5a6f87;
    font-weight:700;
}
.item-title{font-weight:700;margin-bottom:4px}

.pagination{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    padding:16px 20px;
}
.page-link{
    display:inline-flex;
    min-width:40px;
    justify-content:center;
    padding:9px 12px;
    border:1px solid #c8d8ea;
    border-radius:10px;
    background:#fff;
}
.page-link.active{
    background:#0d63ae;
    color:#fff;
    border-color:#0d63ae;
}

/* ===== HOME MODULES ===== */
.home-sections{display:grid;gap:32px}
.news-module{
    background:#fff;
    border-radius:24px;
    border:1px solid #d8e6f5;
    box-shadow:0 14px 32px rgba(16,47,97,.06);
    overflow:hidden;
    margin-bottom:20px;
}
.news-module__head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:24px 30px;
    background:linear-gradient(135deg,#eef7ff,#f8fbff);
    border-bottom:1px solid #dfeaf6;
}
.news-module__title{
    margin:0;
    font-size:23px;
    font-weight:800;
    color:#0d4f92;
}
.news-module__title a,
.news-module__more{
    color:inherit;
    text-decoration:none;
}
.news-module__more{
    font-weight:700;
    color:#0d63ae;
}
.news-module__body{padding:0 30px}
.news-card{
    display:grid;
    grid-template-columns:300px 1fr;
    gap:20px;
    align-items:start;
    padding:20px 0;
    border-bottom:1px dashed #dce4ef;
    text-decoration:none;
    color:inherit;
    transition:all .24s ease;
}
.news-card:last-child{border-bottom:none}
.news-card:hover{transform:translateY(-2px)}
.news-card__thumb-wrap{
    overflow:hidden;
    border-radius:12px;
    background:#edf4fb;
}
.news-card__thumb{
    width:100%;
    height:200px;
    object-fit:cover;
    display:block;
    transition:transform .35s ease;
}
.news-card:hover .news-card__thumb{transform:scale(1.03)}
.news-card__thumb--empty{background:linear-gradient(135deg,#edf4fb,#dde8f4)}
.news-card__thumb--fallback{
    object-fit:contain;
    box-sizing:border-box;
    padding:26px;
    background:linear-gradient(135deg,#edf4fb,#e5eff9);
}
.news-card__content{display:grid;gap:10px;align-content:start}
.news-card__title{
    order:1;
    font-size:20px;
    font-weight:800;
    color:#1a2f4c;
    line-height:1.4;
    transition:color .22s ease;
}
.news-card:hover .news-card__title{color:#0d63ae}
.news-card__date{
    order:2;
    font-size:13px;
    color:#0d63ae;
    font-weight:700;
}
.news-card__summary{
    order:3;
    font-size:15px;
    color:#475569;
    line-height:1.7;
}
.news-empty{padding:26px 0;color:#6d8095}

/* ===== OTHER MODULES ===== */
.module-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
}
.module-card h3{margin-top:0;margin-bottom:10px}
.news-list{display:grid;gap:16px}
.news-meta{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:8px}
.news-drug{font-weight:700;color:#102f61;margin-bottom:10px}
.news-excerpt{color:#475569;line-height:1.6;margin-bottom:14px}

.cgd-detail{
    display:grid;
    grid-template-columns:1.35fr .85fr;
    gap:20px;
    align-items:start;
}
.pdf-like{padding:24px}
.pdf-like-header{
    display:flex;
    justify-content:space-between;
    gap:16px;
    border-bottom:2px solid #dce4ef;
    padding-bottom:12px;
    margin-bottom:16px;
}
.org-name{font-weight:700}
.pdf-main-title{text-align:center;color:#123f7b;font-size:28px;margin:18px 0}
.pdf-layout-table{width:100%;min-width:0}
.pdf-layout-table th,.pdf-layout-table td{border:1px solid #cbd5e1}
.rich-content{line-height:1.75}
.rich-content h3,.rich-content h4{margin:14px 0 10px}
.rich-content ul,.rich-content ol{padding-left:22px}
.pdf-sidebar{position:sticky;top:90px}
.pdf-frame{width:100%;height:720px;border:none}

.auth-body{
    min-height:100vh;
    background:linear-gradient(135deg,#0e3970,#1f66b3);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
}
.auth-wrap{width:100%;max-width:460px}
.auth-brand{margin-bottom:16px}

/* ===== RESPONSIVE ===== */
@media (max-width:1180px){
    .header-inner{flex-wrap:wrap}
    .mobile-menu-toggle{display:inline-flex;margin-left:auto}
    .header-right{
        display:none;
        width:100%;
        flex-direction:column;
        align-items:stretch;
        justify-content:flex-start;
        border-top:1px solid #e7eef6;
        padding-top:14px;
        gap:14px;
    }
    .header-right.open{display:flex}
    .main-nav{
        flex-direction:column;
        align-items:stretch;
        white-space:normal;
        margin-left:0;
    }
    .search-toggle-wrap,.user-dropdown{
        margin-left:0;
    }
    .header-search-pop{
        left:0;
        right:auto;
        width:100%;
        max-width:none;
    }
}
@media (max-width:900px){
    .filter-grid,.form-grid,.module-grid,.cgd-detail,.news-filter{
        grid-template-columns:1fr;
    }
    .span-2{grid-column:span 1}
    .news-card{grid-template-columns:1fr}
    table{min-width:700px}
}
@media (max-width:640px){
    .brand img{width:52px;height:52px}
    .brand-title{font-size:17px}
    .brand-subtitle{font-size:14px}
    .news-module__head{padding:20px 18px}
    .news-module__body{padding:0 18px}
    .news-module__title{font-size:21px}
    .news-card__title{font-size:18px}
    .news-card__summary{font-size:15px}
}

/* ===== NEWS LISTING MOCKUP STYLE ===== */
.news-mockup-section{
    background:#fff;
    border:1px solid #d8e6f5;
    border-radius:28px;
    overflow:hidden;
    box-shadow:0 10px 24px rgba(16,47,97,.05);
    margin-bottom:24px;
}

.news-mockup-head{
    background:#edf5ff;
    padding:22px 28px;
    border-bottom:1px solid #dbe8f6;
}

.news-mockup-head__title{
    margin:0;
    font-size:24px;
    line-height:1.2;
    font-weight:800;
    color:#0d4f92;
}

.news-mockup-body{
    padding:24px 28px;
}

.news-mockup-item{
    display:grid;
    grid-template-columns:360px 1fr;
    gap:24px;
    align-items:start;
}

.news-mockup-item__thumb-wrap{
    display:block;
    border-radius:18px;
    overflow:hidden;
    background:#edf4fb;
}

.news-mockup-item__thumb{
    width:100%;
    height:250px;
    object-fit:cover;
    display:block;
}

.news-mockup-item__thumb--empty{
    background:linear-gradient(135deg,#edf4fb,#dde8f4);
}

.news-mockup-item__content{
    display:grid;
    gap:14px;
    align-content:start;
    padding-top:4px;
}

.news-mockup-item__title{
    margin:0;
    font-size:27px;
    line-height:1.45;
    font-weight:800;
    color:#153962;
}

.news-mockup-item__title a{
    color:inherit;
    text-decoration:none;
}

.news-mockup-item__title a:hover{
    color:#0d63ae;
}

.news-mockup-item__date{
    font-size:18px;
    line-height:1.3;
    font-weight:700;
    color:#0d63ae;
}

.news-mockup-item__summary{
    margin:0;
    font-size:18px;
    line-height:1.8;
    color:#4d6177;
}

.news-mockup-empty{
    padding:20px 0;
    color:#64748b;
}

@media (max-width: 900px){
    .news-mockup-item{
        grid-template-columns:1fr;
    }

    .news-mockup-item__thumb{
        height:220px;
    }

    .news-mockup-item__title{
        font-size:22px;
    }

    .news-mockup-item__date{
        font-size:16px;
    }

    .news-mockup-item__summary{
        font-size:16px;
    }
}

/* ===== FIX BANG USER: PHAN HE 2 DONG ===== */

.users-table{
    table-layout: fixed;
    width: 100%;
}

/* CHIA LAI TY LE COT */
.users-table__col-name{ width: 18%; }
.users-table__col-username{ width: 14%; }
.users-table__col-permissions{ width: 32%; }
.users-table__col-actions{ width: 36%; min-width: 320px; }

/* PHAN HE CHI TOI DA 2 DONG */
.users-permissions-text{
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow: hidden;
    text-overflow: ellipsis;

    line-height: 1.6;
    max-height: 3.2em;

    word-break: break-word;
    white-space: normal;

    max-width: 100%;
}

/* GIU CHO NUT KHONG BI DAY */
.users-table__cell-actions{
    white-space: normal;
}

/* CANH NUT CHO DEP */
.users-inline-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* LOGIN LAYOUT THEO MAU */
.auth-body{
    min-height:100vh;
    background:linear-gradient(180deg,#0f4e93 0%, #1b5fa8 100%);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
}

.admin-login-page{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
}

.admin-login-card{
    width:100%;
    max-width:460px;
    background:#ffffff;
    border-radius:22px;
    padding:22px 22px 26px;
    box-shadow:0 22px 50px rgba(6,34,74,.22);
}

.admin-login-card__head{
    display:flex;
    align-items:center;
    gap:16px;
    margin-bottom:20px;
}

.admin-login-card__logo{
    width:64px;
    height:64px;
    border-radius:50%;
    overflow:hidden;
    flex:0 0 64px;
    background:#fff;
    border:1px solid #dce4ef;
    display:flex;
    align-items:center;
    justify-content:center;
}

.admin-login-card__logo img{
    width:100%;
    height:100%;
    object-fit:contain;
}

.admin-login-card__eyebrow{
    font-size:13px;
    line-height:1.3;
    color:#3f5268;
    margin-bottom:4px;
}

.admin-login-card__title{
    margin:0;
    font-size:24px;
    line-height:1.2;
    font-weight:800;
    color:#153962;
}

.admin-login-form{
    display:grid;
    gap:16px;
}

.admin-login-card .field label{
    display:block;
    margin-bottom:8px;
    font-size:14px;
    font-weight:700;
    color:#153962;
}

.admin-login-card .field input{
    width:100%;
    height:42px;
    padding:0 14px;
    border:1px solid #b9cadc;
    border-radius:14px;
    background:#ffffff;
    color:#1f2f45;
    outline:none;
    font-size:14px;
}

.admin-login-card .field input:focus{
    border-color:#0d63ae;
    box-shadow:0 0 0 3px rgba(13,99,174,.08);
}

.admin-login-form__actions{
    margin-top:2px;
}

.admin-login-submit{
    width:100%;
    min-height:44px;
    border-radius:14px;
    font-size:14px;
    font-weight:800;
}

.admin-login-card__sample{
    margin-top:14px;
    font-size:13px;
    color:#5e7087;
}

.admin-login-card .alert{
    margin-bottom:14px;
    border-radius:14px;
}

.admin-login-card__lockout{
    margin-top:4px;
}

@media (max-width: 640px){
    .auth-body{
        padding:18px;
    }

    .admin-login-card{
        max-width:100%;
        padding:20px 18px 22px;
    }

    .admin-login-card__title{
        font-size:22px;
    }
}

.pv-desc{
    margin: 8px 0 14px;
    color:#555;
    line-height:1.6;
    font-size:14px;
}

.pv-desc a{
    color:#0b5cad;
    font-weight:600;
    text-decoration:none;
}

.pv-desc a:hover{
    text-decoration:underline;
}

/* ===== FIX8: BRAND TRÁI + MENU 2 HÀNG PHÍA BÊN PHẢI ===== */
.header-inner{
    display:grid;
    grid-template-columns:minmax(335px, 390px) minmax(0, 1fr);
    align-items:center;
    gap:24px;
    padding:10px 0;
}
.header-inner > .brand{
    grid-column:1;
    grid-row:1;
    align-self:center;
    min-width:0;
}
.header-inner > .mobile-menu-toggle{
    display:none;
}
.header-right{
    grid-column:2;
    grid-row:1;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:4px;
    width:100%;
    min-width:0;
    margin:0;
}
.desktop-menu-row{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    min-width:0;
    min-height:42px;
}
.desktop-menu-row--top{
    border-bottom:1px solid #edf2f7;
    padding-bottom:4px;
}
.desktop-menu-row--bottom{
    padding-top:4px;
}
.main-nav,
.site-nav{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:nowrap;
    gap:6px;
    width:auto;
    min-width:0;
    margin:0;
    white-space:nowrap;
}
.main-nav a,
.site-nav a{
    flex:0 0 auto;
    white-space:nowrap;
    padding:7px 10px;
    font-size:14px;
    line-height:1.25;
}
.header-tools{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:7px;
    flex:0 0 auto;
    margin-left:6px;
}
.header-tools .search-toggle-wrap{
    margin-left:0;
}

/* Màn hình desktop hẹp: thu nhỏ vừa phải nhưng vẫn giữ 2 hàng bên phải. */
@media (max-width:1180px) and (min-width:1001px){
    .header-inner{
        grid-template-columns:minmax(300px, 340px) minmax(0,1fr);
        gap:14px;
    }
    .brand img,
    .site-brand__logo{
        width:54px;
        height:54px;
        max-width:54px;
        max-height:54px;
        flex-basis:54px;
    }
    .brand-title{
        font-size:17px;
    }
    .brand-subtitle{
        font-size:13px;
    }
    .main-nav a,
    .site-nav a{
        padding:7px 8px;
        font-size:13px !important;
    }
    .desktop-menu-row,
    .header-tools{
        gap:5px;
    }
}

/* Tablet/mobile: logo ở trái, nút hamburger ở phải; menu mở dọc. */
@media (max-width:1000px){
    .header-inner{
        display:grid;
        grid-template-columns:minmax(0,1fr) 44px;
        align-items:center;
        gap:10px 12px;
        padding:10px 0;
    }
    .header-inner > .brand{
        grid-column:1;
        grid-row:1;
    }
    .header-inner > .mobile-menu-toggle{
        display:inline-flex;
        grid-column:2;
        grid-row:1;
        margin-left:auto;
    }
    .header-right{
        grid-column:1 / -1;
        grid-row:2;
        display:none;
        width:100%;
        margin:0;
        padding:10px 0 2px;
        border-top:1px solid #e7eef6;
    }
    .header-right.open{
        display:flex;
    }
    .desktop-menu-row{
        display:flex;
        flex-direction:column;
        align-items:stretch;
        justify-content:flex-start;
        gap:6px;
        min-height:0;
        width:100%;
        border:0;
        padding:0;
    }
    .desktop-menu-row--bottom{
        margin-top:6px;
    }
    .main-nav,
    .site-nav{
        width:100%;
        flex-direction:column;
        align-items:stretch;
        justify-content:flex-start;
        gap:6px;
    }
    .main-nav a,
    .site-nav a{
        display:block;
        width:100%;
        text-align:left;
        padding:10px 12px;
        font-size:14px !important;
    }
    .header-tools{
        width:100%;
        justify-content:flex-end;
        gap:8px;
        margin:8px 0 0;
        padding-top:8px;
        border-top:1px solid #edf2f7;
    }
}

@media (max-width:640px){
    .brand img,
    .site-brand__logo{
        width:48px;
        height:48px;
        max-width:48px;
        max-height:48px;
        flex-basis:48px;
    }
    .brand-title{
        font-size:15px;
        line-height:1.25;
    }
    .brand-subtitle{
        font-size:12px;
    }
    .brand,
    .site-brand{
        gap:9px;
    }
    .header-tools{
        justify-content:flex-start;
    }
}

.user-dropdown-menu--grouped{scrollbar-width:thin}
.dropdown-quick-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    padding:10px 14px 12px;
    border-bottom:1px solid #edf2f7;
}
.dropdown-quick-item{
    display:block;
    padding:10px 12px;
    border:1px solid #dce4ef;
    border-radius:14px;
    background:#f8fbff;
    text-decoration:none;
    color:#172033;
    transition:all .18s ease;
}
.dropdown-quick-item:hover{
    background:#eef5ff;
    border-color:#c7d7ed;
    transform:translateY(-1px);
}
.dropdown-quick-label{display:block;font-size:14px;font-weight:700;color:#123564}
.dropdown-quick-meta{display:block;margin-top:3px;font-size:12px;color:#64748b}
.dropdown-sections{padding:8px 0 0}
.dropdown-section{padding:0 14px 8px}
.dropdown-section + .dropdown-section{margin-top:2px}
.dropdown-section-title{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:12px;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:#4b6485;
    padding:8px 2px 8px;
}
.dropdown-section-items{display:grid;grid-template-columns:1fr;gap:6px}
.dropdown-item--module{
    padding:11px 12px;
    border:1px solid #edf2f7;
    border-radius:12px;
    text-decoration:none;
    background:#fff;
}
.dropdown-item--module:hover{background:#f8fbff;border-color:#d6e3f4}
.dropdown-item-label{display:block;font-size:14px;font-weight:700;color:#172033;line-height:1.35}
.dropdown-item-desc{display:block;margin-top:3px;font-size:12px;line-height:1.45;color:#64748b}

body.dark-mode .user-dropdown-menu{background:#0f172a;border-color:#243244;box-shadow:0 18px 40px rgba(0,0,0,.45)}
body.dark-mode .user-dropdown-header,
body.dark-mode .dropdown-quick-grid{border-bottom-color:#243244}
body.dark-mode .user-name{color:#e5eefc}
body.dark-mode .user-username{color:#94a3b8}
body.dark-mode .dropdown-quick-item,
body.dark-mode .dropdown-item--module{background:#111c31;border-color:#243244;color:#e5eefc}
body.dark-mode .dropdown-quick-item:hover,
body.dark-mode .dropdown-item--module:hover{background:#18253d;border-color:#304562}
body.dark-mode .dropdown-quick-label,
body.dark-mode .dropdown-item-label{color:#eef4ff}
body.dark-mode .dropdown-quick-meta,
body.dark-mode .dropdown-item-desc,
body.dark-mode .dropdown-section-title{color:#9fb1ca}

@media (max-width: 768px){
    .user-dropdown-menu{width:min(94vw, 360px);right:-4px;max-height:78vh}
    .dropdown-quick-grid{padding:10px 12px 12px}
    .dropdown-section{padding:0 12px 8px}
}
