/* =============================================================================
   Theo dõi chỉ tiêu Nghị quyết — giao diện
   Mọi màu khai ở :root bên dưới; phần còn lại chỉ dùng biến (không ghi mã màu rời rạc).
   Sửa file này xong nhớ tăng ?v=N ở Site.master và Pages/Login.aspx.
   ============================================================================= */

:root {
    --c-primary: #1d4e89;
    --c-primary-dark: #123760;
    --c-primary-soft: #e6eef8;
    --c-accent: #f2b705;
    --c-ink: #1f2933;
    --c-muted: #566170;
    --c-line: #dfe3e8;
    --c-bg: #f4f5f7;
    --c-surface: #ffffff;
    --c-head: #eef1f5;

    --c-done: #17753f;
    --c-done-soft: #dff3e8;
    --c-progress: #8a5a00;
    --c-progress-soft: #fdf1d3;
    --c-behind: #b02a1d;
    --c-behind-soft: #fbe3e0;
    --c-nodata: #5b6673;
    --c-nodata-soft: #e9edf1;

    --radius: 4px;
    --shadow: none;
    --font-title: "Arimo", "Arial", "Helvetica Neue", sans-serif;
    --font-base: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

body {
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: var(--font-base);
    font-size: 16px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Khung trang ---------- */
.app-header-top { background: var(--c-primary); color: #fff; padding: .5rem 0; }
.app-brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.app-logo { height: 44px; width: 44px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.app-logo-fallback { display: inline-flex; align-items: center; justify-content: center; color: var(--c-primary); font-size: 1.4rem; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.app-brand-org { font-weight: 600; font-size: .95rem; letter-spacing: .02em; text-transform: uppercase; }
.app-brand-name { font-size: .85rem; opacity: .9; }
.btn-user {color: #fff;border: 1px solid rgba(255, 255, 255, .35);display: flex;align-items: center;justify-content: center;gap: 10px;font-size: 14px;}
.btn-user:hover, .btn-user:focus, .btn-user.show { color: #fff; background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .6); }

.app-nav { background: var(--c-surface); border-bottom: 1px solid var(--c-line); }
.app-nav-list {flex-wrap: nowrap;overflow-x: auto;overflow-y: hidden;scrollbar-width: thin;justify-content: center;gap: 30px;}
.app-nav .nav-link {color: var(--c-ink);padding: .8rem 1rem;white-space: nowrap;border-bottom: 3px solid transparent;margin-bottom: -3px;font-weight: 600;text-transform: capitalize;}
.app-nav .nav-link i { margin-right: .5rem; color: var(--c-muted); }
.app-nav .nav-link:hover { color: var(--c-primary); }
.app-nav .nav-link.active {color: var(--c-primary);font-weight: 600;border-bottom-color: var(--c-primary);background-color: #104e8626;}
.app-nav .nav-link.active i { color: var(--c-primary); }

.app-main { flex: 1 0 auto; padding-top: 1.25rem; padding-bottom: 2rem; }
.app-footer { background: var(--c-ink); color: #cdd3da; padding: 1.25rem 0; font-size: .85rem; }
.app-footer-title { color: #fff; font-weight: 600; text-transform: uppercase; }
.app-footer-contact { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.app-footer-contact i { margin-right: .4rem; color: var(--c-accent); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.page-title {font-size: 1.45rem;font-weight: 600;margin: 0;color: var(--c-ink);letter-spacing: -.01em;position: relative;padding-top: 3px;padding-bottom: 3px;margin-bottom: 10px;padding-left: 15px;text-transform: uppercase;}
.page-title::before {content: "";display: inline-block;width: 4px;height: 1.1em;background: var(--c-primary);margin-right: .6rem;vertical-align: -.15em;position: absolute;left: 0;height: 100%;top: 0;}
.page-sub { color: var(--c-muted); font-size: .9rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.toolbar .form-select, .toolbar .form-control {width: auto;padding: 10px 30px 10px 20px;font-weight: 500;font-size: 16px;}

.card-box {background: var(--c-surface);border: 1px solid var(--c-line);border-radius: 20px;box-shadow: var(--shadow);}
.card-box-head {padding: .75rem 1.3rem;border-bottom: 1px solid var(--c-line);font-weight: 600;}
.card-box-body { padding: 1rem; }

/* ---------- Dải số liệu: một khung, các số ngăn bằng đường kẻ (không phải 6 thẻ rời) ---------- */
.kpi-grid {display: grid;grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));background: var(--c-surface);border: 1px solid var(--c-line);border-radius: var(--radius);margin-bottom: 1rem;border-radius: 15px;overflow: hidden;}
.kpi { display: flex; flex-direction: column-reverse; padding: .85rem 1.1rem; border-left: 1px solid var(--c-line); border-top: 1px solid var(--c-line); margin: -1px 0 0 -1px; }
.kpi-value {font-size: 1.9rem;font-weight: 600;line-height: 1.1;letter-spacing: -.01em;font-family: "JetBrains Mono", monospace;}
.kpi-label { color: var(--c-muted); font-size: .82rem; display: flex; align-items: center; gap: .4rem; }
.kpi-done .kpi-label::before, .kpi-progress .kpi-label::before, .kpi-behind .kpi-label::before, .kpi-nodata .kpi-label::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.kpi-done .kpi-label::before { background: var(--c-done); }
.kpi-progress .kpi-label::before { background: var(--c-progress); }
.kpi-behind .kpi-label::before { background: var(--c-behind); }
.kpi-nodata .kpi-label::before { background: var(--c-nodata); }
.kpi-done .kpi-value { color: var(--c-done); }
.kpi-progress .kpi-value { color: var(--c-progress); }
.kpi-behind .kpi-value { color: var(--c-behind); }

.chart-box { position: relative; height: 340px; }
.chart-box-tall { position: relative; }

/* ---------- Bảng kiểu Excel ---------- */
.sheet-wrap { overflow-x: auto; }
.sheet-scroll { max-height: calc(100vh - 290px); min-height: 320px; overflow: auto; }
.sheet { width: 100%; border-collapse: collapse; background: var(--c-surface); font-size: .92rem; }
.sheet th, .sheet td {border: 1px solid var(--c-line);padding: .45rem .6rem;}
.sheet thead th { background: var(--c-head); text-align: center; vertical-align: middle; position: sticky; top: 0; z-index: 2; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--c-ink); box-shadow: 0 1px 0 var(--c-line); }
.sheet tbody tr:nth-child(even) td:not(.cell-edit) { background: #fafbfc; }
.sheet .col-stt { width: 56px; text-align: center; }
.sheet .col-center { text-align: center; }
.sheet .col-num { text-align: right; white-space: nowrap; }
.sheet tbody tr:hover td { background: var(--c-primary-soft); }
.sheet .ind-name { font-weight: 600; }
.sheet .ind-desc {color: var(--c-muted);font-size: .85rem;white-space: pre-line;margin-bottom: 8px;line-height: 23px;}
.sheet .muted { color: var(--c-muted); }
.sheet td.cell-edit { padding: 0; background: var(--c-surface); min-width: 170px; }
.sheet td.cell-edit:focus-within { outline: 2px solid var(--c-primary); outline-offset: -2px; }
.cell-input {
    width: 100%;
    border: 0;
    background: transparent;
    padding: .45rem .6rem;
    font: inherit;
    resize: none;
    display: block;
    overflow: hidden;
    min-height: 38px;
    border-bottom: 1px dashed #cccc;
}
.cell-input:focus { outline: none; }
.cell-input.is-invalid { background: var(--c-behind-soft); }
.cell-input[readonly] { color: var(--c-muted); cursor: not-allowed; }
.cell-result { display: flex; align-items: center; }
.cell-result .cell-input {text-align: right;flex: 1 1 auto;border-bottom: 1px dashed #cccc;}
.cell-unit { padding-right: .6rem; color: var(--c-muted); white-space: nowrap; font-size: .85rem; }
.save-state { position: absolute; right: 4px; top: 4px; font-size: .7rem; }
.cell-edit { position: relative; }
.save-state.saving { color: var(--c-muted); }
.save-state.saved { color: var(--c-done); }
.save-state.error { color: var(--c-behind); }

/* ---------- Tiến độ ---------- */
.prog { min-width: 130px; }
.prog-pct { font-weight: 700; font-size: 1rem; }
.prog-bar { height: 5px; background: var(--c-nodata-soft); border-radius: 3px; overflow: hidden; margin: .25rem 0; }
.prog-fill { height: 100%; background: var(--c-nodata); border-radius: 3px; transition: width .25s; }
.st-done .prog-fill { background: var(--c-done); }
.st-progress .prog-fill { background: var(--c-progress); }
.st-behind .prog-fill { background: var(--c-behind); }
.st-done .prog-pct { color: var(--c-done); }
.st-progress .prog-pct { color: var(--c-progress); }
.st-behind .prog-pct { color: var(--c-behind); }

.badge-st { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 3px; font-size: .78rem; font-weight: 600; background: var(--c-nodata-soft); color: var(--c-nodata); }
.badge-st.st-done { background: var(--c-done-soft); color: var(--c-done); }
.badge-st.st-progress { background: var(--c-progress-soft); color: var(--c-progress); }
.badge-st.st-behind { background: var(--c-behind-soft); color: var(--c-behind); }

/* ---------- Chọn tháng ---------- */
.month-tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.month-tabs .btn {min-width: 48px;border-radius: 10px;}
.month-tabs .btn.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---------- Nút ---------- */
.btn-primary { --bs-btn-bg: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary-dark); --bs-btn-hover-border-color: var(--c-primary-dark); --bs-btn-active-bg: var(--c-primary-dark); --bs-btn-active-border-color: var(--c-primary-dark); --bs-btn-disabled-bg: var(--c-primary); --bs-btn-disabled-border-color: var(--c-primary); }
.btn-outline-primary { --bs-btn-color: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary); --bs-btn-hover-border-color: var(--c-primary); --bs-btn-active-bg: var(--c-primary-dark); --bs-btn-active-border-color: var(--c-primary-dark); }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 .2rem var(--c-primary-soft); }
.btn-icon { padding: .15rem .45rem; }

/* ---------- Cài đặt ---------- */
.settings-group { margin-bottom: 1rem; }
.setting-row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: .5rem 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--c-line); align-items: start; }
.setting-row:last-child { border-bottom: 0; }
.setting-label { font-size: .88rem; color: var(--c-muted); padding-top: .4rem; }
.setting-image { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.setting-image img { max-height: 64px; max-width: 160px; background: var(--c-head); border: 1px solid var(--c-line); border-radius: 6px; padding: 4px; }
.save-bar { position: sticky; bottom: 0; background: var(--c-surface); border-top: 1px solid var(--c-line); padding: .75rem 1rem; display: flex; justify-content: flex-end; gap: .5rem; margin: 0 -.75rem -.75rem; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Đăng nhập ---------- */
.login-page { background: var(--c-primary-dark); align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; background: var(--c-surface); border-radius: 6px; padding: 2rem 1.75rem; border-top: 4px solid var(--c-accent); }
.login-head { text-align: center; margin-bottom: 1.5rem; }
.login-head .app-logo { height: 72px; width: 72px; border: 2px solid var(--c-accent); margin-bottom: .75rem; }
.login-org { font-weight: 700; color: var(--c-primary-dark); text-transform: uppercase; }
.login-app { color: var(--c-muted); font-size: .9rem; }

.empty-state { text-align: center; color: var(--c-muted); padding: 2.5rem 1rem; }
.is-loading { opacity: .5; pointer-events: none; }

@media (max-width: 767.98px) {
    .setting-row { grid-template-columns: 1fr; }
    .kpi-value { font-size: 1.5rem; }
    .app-brand-text .app-brand-name { display: none; }
}

@media print {
    .app-header, .app-footer, .toolbar, .no-print, .toast-container { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .card-box { box-shadow: none; border: 0; }
    .sheet thead th { position: static; }
    .chart-box { height: 260px; }
}

/* ---------- Truy cập & phản hồi ---------- */
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.cell-input:focus-visible { outline: none; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 9999; background: var(--c-accent); color: var(--c-ink); padding: .5rem 1rem; font-weight: 600; }
.skip-link:focus { left: 0; }

.entry-progress { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.entry-progress .prog-bar { flex: 1 1 200px; height: 8px; margin: 0; }
.entry-progress .prog-fill { background: var(--c-primary); }
.entry-progress-text { font-size: .9rem; white-space: nowrap; }

.row-saved td:first-child { box-shadow: inset 3px 0 0 var(--c-done); }
.row-empty .col-stt { color: var(--c-muted); }

.pw-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--c-muted); padding: .35rem .5rem; }
.pw-wrap { position: relative; }

.table-loading { position: relative; min-height: 120px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--c-head) 25%, var(--c-nodata-soft) 50%, var(--c-head) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Phông tiêu đề (Arimo) ---------- */
h1, h2, h3, h4, h5, h6, .page-title, .card-box-head, .app-brand-org, .login-org, .app-footer-title, .modal-title { font-family: var(--font-title); }
.page-title, .modal-title { font-weight: 700; }
