:root {
    --ink: #2b2b2b;
    --border: #d9d9d9;
    --header-blue: #dce9f5;
    --cat-yellow: #fdf1cf;
    --cat-green: #e4f0e0;
    --done: #3a8a3a;
    --inprogress: #b8860b;
    --late: #c0392b;
    --todo: #8a8a8a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: #f7f7f7;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.nav-link {
    margin-left: 16px;
    text-decoration: none;
    color: #2b5797;
    font-size: 0.9rem;
}
.user-name { font-size: 0.85rem; color: #666; margin-right: 4px; }

.container { max-width: 900px; margin: 30px auto; padding: 0 20px 60px; }

.board-title {
    text-align: center;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    margin-bottom: 18px;
}

.hint { color: #666; font-size: 0.9rem; margin-bottom: 12px; }

.goal-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 0 0 1px var(--border);
}
.goal-table th {
    background: var(--header-blue);
    text-align: left;
    padding: 10px 14px;
    font-size: 0.9rem;
}
.goal-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.col-stt { width: 50px; text-align: center; }
.col-status { width: 160px; }

.category-row td {
    font-weight: 700;
    background: #fff;
    padding-top: 10px;
}

/* Màu dải theo nhóm - luân phiên vàng/xanh giống bảng gốc */
.item-row:nth-of-type(4n+1),
.item-row:nth-of-type(4n+2) { }

tbody tr.item-row { background: var(--cat-yellow); }
tbody tr.item-row.status-done,
tbody tr.item-row.status-inprogress,
tbody tr.item-row.status-late,
tbody tr.item-row.status-todo { }

/* Áp màu nhóm bằng cách tô theo category-row liền trước qua CSS không khả thi thuần CSS,
   nên màu nhóm được set trực tiếp qua thuộc tính style ở view nếu muốn tách vàng/xanh triệt để.
   Mặc định dưới đây tô nhẹ toàn bộ theo trạng thái để dễ nhìn tiến độ. */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}
.status-done .status-badge { background: var(--done); }
.status-inprogress .status-badge { background: var(--inprogress); }
.status-late .status-badge { background: var(--late); }
.status-todo .status-badge { background: var(--todo); }

.admin-table select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.empty-row { text-align: center; color: #888; padding: 30px; }

.month-filter {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}
.month-filter select {
    margin-left: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.month-filter button {
    padding: 5px 14px;
    border: none;
    border-radius: 4px;
    background: #2b5797;
    color: #fff;
    cursor: pointer;
}

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

.admin-nav-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.section-sub {
    margin-top: 28px;
    font-size: 1rem;
}

.create-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.create-form select,
.create-form input[type="text"] {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}
.create-form input[type="text"] { flex: 1; min-width: 240px; }
.create-form button {
    padding: 7px 16px;
    border: none;
    border-radius: 4px;
    background: #2b8a3e;
    color: #fff;
    cursor: pointer;
}

.btn-delete {
    padding: 4px 10px;
    border: 1px solid var(--late);
    color: var(--late);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-delete:hover { background: var(--late); color: #fff; }

.btn-restore {
    padding: 4px 10px;
    border: 1px solid #2b8a3e;
    color: #2b8a3e;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-restore:hover { background: #2b8a3e; color: #fff; }

.gate-wrap {
    min-height: calc(100vh - 49px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.gate-box {
    width: 100%;
    max-width: 340px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 28px 26px;
    text-align: center;
}
.gate-title { margin: 0 0 6px; font-size: 1.2rem; }
.gate-hint { margin: 0 0 18px; color: #777; font-size: 0.88rem; }
.gate-error {
    background: #fdecea;
    color: var(--late);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}
.gate-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.gate-button {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: #2b5797;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}
.gate-button:hover { background: #234a80; }

.col-updated {
    font-size: 0.82rem;
    color: #666;
    white-space: nowrap;
}

.fs-table .col-updated-fs {
    width: 190px;
    font-size: 0.78em;
    color: #777;
    white-space: nowrap;
}
.fs-table .updated-by {
    color: #999;
    font-size: 0.95em;
}

/* ================= FULL-SCREEN DASHBOARD (trang chính) ================= */
html, body.fullscreen-page {
    height: 100%;
    margin: 0;
    background: #eef1f5;
}

.topbar-overlay {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
}

.fullscreen-main {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: calc(100vh - 49px); /* trừ chiều cao topbar */
}

.fs-board {
    height: 100%;
    min-height: calc(100vh - 49px);
    padding: 24px 32px 32px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.fs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.fs-title {
    margin: 0;
    font-size: clamp(1.4rem, 2.4vw, 2.1rem);
    letter-spacing: 0.5px;
    color: #1f2a37;
}

.fs-logo {
    height: 50px;
}
.fs-filter {
    margin: 0;
}

.fs-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 1.1rem;
}

.fs-table-wrap {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.fs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.95rem, 1.3vw, 1.25rem);
}
.fs-table th {
    background: var(--header-blue);
    text-align: left;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.fs-table td {
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.fs-table .col-stt { width: 70px; text-align: center; }
.fs-table .col-status { width: 220px; }
.fs-table .category-row td {
    font-weight: 700;
    font-size: clamp(1rem, 1.5vw, 1.4rem);
    background: #fff;
    padding-top: 22px;
}
.fs-table tbody tr.item-row { background: var(--cat-yellow); }
.fs-table .status-badge {
    padding: 5px 16px;
    font-size: clamp(0.8rem, 1vw, 1rem);
}

.fs-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.live-indicator {
    font-size: 0.8rem;
    color: #999;
}
.live-indicator.live-ok { color: var(--done); }
.live-indicator.live-bad { color: var(--late); }

@media (max-width: 640px) {
    .fs-board { padding: 16px; }
}

/* ================= TRANG NHẬP MẬT KHẨU (Gate) ================= */
.gate-wrap {
    min-height: calc(100vh - 49px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.gate-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    padding: 36px 32px;
    width: 100%;
    max-width: 340px;
    text-align: center;
}
.gate-title { margin: 0 0 6px; font-size: 1.3rem; }
.gate-hint { margin: 0 0 20px; color: #777; font-size: 0.9rem; }
.gate-error {
    background: #fdecea;
    color: var(--late);
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.gate-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 14px;
    box-sizing: border-box;
}
.gate-button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: #2b5797;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
.gate-button:hover { background: #234a80; }

/* ================= SLIDESHOW (Mục tiêu tháng / Mục tiêu năm / Live Pictures) ================= */
.fs-slides {
    flex: 1;
    position: relative;
    display: flex;
}

.fs-slide {
    display: none;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    animation: fs-fade-in 0.4s ease;
}
.fs-slide.active {
    display: flex;
}

@keyframes fs-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}
.slide-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #cfd6df;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}
.slide-dots .dot:hover { background: #9fb0c3; }
.slide-dots .dot.active {
    background: #2b5797;
    transform: scale(1.25);
}

.fs-slide-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #1f2a37;
}

/* --- Live Pictures: lưới masonry, tự động zoom lần lượt từng ảnh --- */
.live-masonry-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
}
.live-masonry {
    height: 100%;
    overflow-y: auto;
    column-count: 3;
    column-gap: 14px;
    padding: 2px 2px 14px;
}
@media (min-width: 1500px) { .live-masonry { column-count: 4; } }
@media (max-width: 1000px) { .live-masonry { column-count: 2; } }

.live-photo {
    position: relative;
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    background: #eee;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: opacity 0.3s ease;
}
.live-photo img {
    width: 100%;
    display: block;
}
.live-photo-caption {
    padding: 6px 10px;
    font-size: 0.78rem;
    color: #445;
    background: #fff;
}
.live-photo-caption:empty { display: none; }

/* Ảnh gốc mờ đi trong lúc bản phóng to của chính nó đang hiện trên overlay */
.live-photo.is-zooming { opacity: 0.15; }

/* Overlay + "stage" dùng kỹ thuật FLIP: bắt đầu đúng vị trí/kích thước ảnh nhỏ, animate lên full khung */
.live-zoom-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,14,20,0);
    opacity: 0;
    pointer-events: none;
    transition: background 0.4s ease, opacity 0.4s ease;
    z-index: 5;
}
.live-zoom-overlay.visible {
    background: rgba(10,14,20,0.92);
    opacity: 1;
    pointer-events: auto;
}
.live-zoom-stage {
    position: absolute;
    inset: 24px;
    will-change: transform;
}
.live-zoom-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}
.live-zoom-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 12px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
    color: #fff;
    font-size: 1rem;
    text-align: center;
}
.live-zoom-caption:empty { display: none; }

/* --- Quản trị: Mục tiêu năm / Pictures (dùng lại style admin sẵn có) --- */
.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.picture-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.picture-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.picture-card .picture-meta {
    padding: 8px 10px;
    font-size: 0.78rem;
    color: #666;
}
.picture-card .picture-caption {
    font-size: 0.85rem;
    color: #333;
    padding: 0 10px;
    margin-top: 4px;
}
.picture-card form { padding: 0 10px 10px; }

.upload-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}
.upload-form input[type="file"] {
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}

/* --- Quản lý danh mục: 2 cột Tháng / Năm tách biệt --- */
.groups-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
    margin-top: 16px;
}
.groups-col .section-sub { margin-top: 0; }
