/* ===== Trang chủ - Phần mềm quản lý sáng kiến ===== */
:root {
    --primary: #0d5ea8;
    --primary-dark: #0a3f7a;
    --accent: #29a8dc;
    --text: #1f2d3d;
    --muted: #6b7a8c;
    --bg: #f1f6fb;
    --card: #ffffff;
    --card-soft: #eaf2fa;
    --border: #dde6f0;
    --radius: 10px;
    --shadow: 0 4px 18px rgba(13, 94, 168, .08);

    --c-total: #1f7ea8;
    --c-processing: #5fd3b8;
    --c-passed: #29a8dc;
    --c-failed: #e8735a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== Nút ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 22px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    transition: .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1b93c6; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid #fff; }
.btn-outline:hover { background: transparent; color: #fff; }

/* ===== Header ===== */
.site-header {
    background: linear-gradient(90deg, #0a3f7a 0%, #0d5ea8 60%, #0a3f7a 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 15px; letter-spacing: .3px; }
.brand-text small { font-size: 11px; color: #9fd4f5; }

.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav > a:not(.btn) { font-weight: 500; font-size: 13px; }
.main-nav > a:not(.btn):hover { color: #9fd4f5; }
.nav-user {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 6px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
    background: #fff;
}

/* ===== Banner ===== */
.hero {
    margin: 0px 0;
    background: #fff;
}
.hero-img {
    width: 100%;
    height: auto;
}

/* ===== Section ===== */
.section { padding: 56px 0 24px; }
.section-title {
    text-align: center;
    margin: 0 0 32px;
    font-size: 28px;
    font-weight: 800;
    color: #111;
}

.block { margin-bottom: 44px; scroll-margin-top: 84px; }
.block-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.block-heading { display: flex; align-items: center; gap: 12px; }
.block-heading h3 { margin: 0; font-size: 20px; font-weight: 700; }
.block-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.block-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #29a8dc, #0d5ea8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.block-icon svg { width: 24px; height: 24px; fill: #fff; }

/* ===== Bộ lọc ===== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 8px 0 10px;
    height: 36px;
    font-size: 12px;
}
.filter span { font-weight: 600; color: var(--text); white-space: nowrap; }
.filter select {
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    min-width: 60px;
}
.filter-wide select { min-width: 170px; }
.filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    transition: color .2s, border-color .2s;
}
.filter-reset:hover { color: var(--primary); border-color: var(--primary); }
.filter-reset svg { width: 16px; height: 16px; }

/* ===== Card & Grid ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 20px 16px;
    min-width: 0;
}
.card-soft { background: var(--card-soft); }
.card-title {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.chart-box { position: relative; height: 280px; }
.chart-lg { height: 300px; }
.chart-tall { height: 340px; }

/* ===== Donut ===== */
.donut-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 8px auto 28px;
}
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.donut-center strong { font-size: 24px; color: var(--primary-dark); line-height: 1; }
.donut-center span { font-size: 12px; font-weight: 600; color: var(--primary-dark); }

.field-legend { list-style: none; margin: 0; padding: 0; }
.field-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    color: var(--muted);
}
.field-legend i { width: 10px; height: 10px; border-radius: 2px; background: #ccc; }
.field-legend span { flex: 1; }
.field-legend b { color: var(--text); }

/* ===== Tin tức ===== */
.section-news { padding-bottom: 56px; }
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.news-card h3 {
    margin: 14px 0 6px;
    font-size: 14px;
    font-weight: 700;
}
.news-card h3 a:hover { color: var(--primary); }
.news-card time { font-size: 11px; color: var(--primary); font-weight: 600; }
.news-card p {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-thumb {
    display: block;
    aspect-ratio: 16 / 8;
    border-radius: 6px;
    overflow: hidden;
    /* nền tạm khi chưa có ảnh */
    background: linear-gradient(135deg, #cfe6f7, #8cc7ee);
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.news-card:hover .news-thumb img { transform: scale(1.04); }

/* ===== Chi tiết tin tức ===== */
.news-detail { background: #fff; padding: 28px 0 40px; }
.news-detail-inner { max-width: 880px; }
.breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--primary); }
.news-detail-title {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: #111;
}
.news-detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--primary);
}
.news-detail-meta time { font-size: 12px; color: var(--muted); }
.news-detail-subtitle { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.icon-btn {
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: var(--primary);
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.news-detail-lead { margin: 18px 0 0; font-weight: 600; }

.news-detail-content { margin-top: 12px; font-size: 14px; line-height: 1.7; }
.news-detail-content p { margin: 0 0 14px; text-align: justify; }
.news-detail-content img { max-width: 100%; height: auto; margin: 0 auto; }
.news-detail-content figure { margin: 20px auto; max-width: 600px; }
.news-detail-content figure img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    /* nền tạm khi chưa có ảnh */
    background: linear-gradient(135deg, #cfe6f7, #8cc7ee);
}
.news-detail-content figcaption { margin-top: 6px; font-size: 12px; font-style: italic; color: var(--muted); text-align: center; }

.news-detail-author { margin: 8px 0 0; text-align: right; font-size: 13px; }
.news-detail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.share { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.share a { color: var(--primary); display: inline-flex; }
.share a:hover { color: var(--accent); }
.share svg { width: 16px; height: 16px; fill: currentColor; }
.news-detail-source { font-size: 13px; }

.news-related { background: #dbe8f5; padding: 32px 0 48px; }
.news-related-title { margin: 0 0 20px; font-size: 18px; font-weight: 700; color: var(--primary); }
.news-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.news-card-sm h3 { margin-top: 10px; font-size: 13px; font-weight: 600; line-height: 1.4; }

/* ===== Footer ===== */
.site-footer {
    background: linear-gradient(90deg, #0a3f7a, #0d5ea8, #0a3f7a);
    color: #fff;
    text-align: center;
    padding: 28px 0 22px;
}
.site-footer strong { display: block; font-size: 14px; }
.site-footer small { display: block; font-size: 11px; color: #cde6f8; }
.site-footer p { margin: 16px 0 0; font-size: 11px; color: #cde6f8; }

.error-box { text-align: center; padding: 40px 16px; }

/* ===== Auth modal (đăng nhập / đăng ký) ===== */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.auth-modal[hidden] { display: none !important; }
.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 40, 70, .55);
}
.auth-modal-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .2);
    padding: 28px 24px 22px;
}
.auth-modal-panel-lg { max-width: 560px; }
.auth-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: 0;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}
.auth-modal-panel h2 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-dark);
}
.auth-hint {
    margin: 0 0 18px;
    font-size: 12px;
    color: var(--muted);
}
.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.auth-field em { color: #d64545; font-style: normal; }
.auth-field-hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.auth-password { position: relative; display: flex; }
.auth-password input { flex: 1; min-width: 0; padding-right: 40px; }
.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.auth-password-toggle:hover { color: var(--primary); }
.auth-password-toggle svg { width: 18px; height: 18px; }
.auth-password-toggle .icon-eye-off,
.auth-password-toggle[aria-pressed="true"] .icon-eye { display: none; }
.auth-password-toggle[aria-pressed="true"] .icon-eye-off { display: block; }
.auth-field-full { grid-column: 1 / -1; }
.auth-field input,
.auth-field select {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
    font-weight: 500;
    color: var(--text);
    background: #fff;
}
.auth-field input:focus,
.auth-field select:focus {
    outline: 2px solid rgba(41, 168, 220, .35);
    border-color: var(--accent);
}
.auth-submit {
    width: 100%;
    margin-top: 16px;
    height: 42px;
    border: 0;
    cursor: pointer;
    border-radius: 999px;
}
.auth-switch {
    margin: 14px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.auth-switch a { color: var(--primary); font-weight: 700; }
.auth-recaptcha-note {
    margin: 10px 0 0;
    text-align: center;
    font-size: 11px;
    line-height: 1.4;
    color: #94a3b8;
}
.auth-recaptcha-note a {
    color: #64748b;
    text-decoration: underline;
}
.auth-msg {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.auth-msg.is-error { background: #fdecea; color: #b42318; }
.auth-msg.is-ok { background: #e8f7ef; color: #067647; }

@media (max-width: 560px) {
    .auth-grid { grid-template-columns: 1fr; }
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .news-related-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 16px 18px;
        background: var(--primary-dark);
    }
    .nav-open .main-nav { display: flex; }
    .brand-text strong { font-size: 13px; }

    .section-title { font-size: 22px; }
    .block-head { align-items: flex-start; }
    .filters, .filter { width: 100%; }
    .filter select { flex: 1; min-width: 0; }
    .filter .ts-wrapper { flex: 1; min-width: 0; }
    .news-grid { grid-template-columns: 1fr; }

    .news-detail-title { font-size: 22px; }
    .news-related-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* ===== Select có tìm kiếm (Tom Select) ===== */
body .ts-dropdown {
    z-index: 1000;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(15, 40, 70, .12);
}
body .ts-dropdown .dropdown-input {
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    font: inherit;
}
body .ts-dropdown .option { padding: 7px 10px; }
body .ts-dropdown .active { background: rgba(41, 168, 220, .12); color: var(--text); }
body .ts-dropdown .no-results { padding: 8px 10px; color: var(--muted); }

.filter .ts-wrapper { min-width: 60px; }
.filter-wide .ts-wrapper { min-width: 170px; }
.filter .ts-wrapper.single .ts-control {
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 18px 0 0;
    min-height: 0;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}
.filter .ts-wrapper.single .ts-control::after { right: 2px; }
.auth-field .ts-wrapper.single .ts-control {
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 30px 0 12px;
    display: flex;
    align-items: center;
    font: inherit;
    font-weight: 500;
    color: var(--text);
    background: #fff;
    box-shadow: none;
}
.auth-field .ts-wrapper.focus .ts-control {
    outline: 2px solid rgba(41, 168, 220, .35);
    border-color: var(--accent);
}

/* ===== In bài viết ===== */
@media print {
    .site-header, .site-footer, .breadcrumb, .icon-btn, .share, .news-related { display: none !important; }
    .news-detail { padding: 0; }
}
