* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Tahoma, Arial, sans-serif; background: #eef1f4; color: #1f2733; font-size: 16px; }
a { color: #1f4e2c; text-decoration: none; } a:hover { text-decoration: underline; }

/* Header */
.topbar { background: linear-gradient(90deg,#163a20,#1f4e2c); color: #fff; padding: 0 16px; display: flex; align-items: center; gap: 12px; height: 52px; box-shadow: 0 2px 6px rgba(0,0,0,.2); position: sticky; top: 0; z-index: 50; }
.burger { display: none; font-size: 24px; cursor: pointer; padding: 4px 8px; }
.topbar .brand { font-weight: 800; font-size: 17px; line-height: 1.1; white-space: nowrap; letter-spacing:.2px; }
.topbar .brand small { display:block; font-weight:600; font-size:11.5px; opacity:.9; letter-spacing:0; }
.topbar nav { display: flex; gap: 2px; margin-left: 8px; }
.topbar nav a { color: #eef5ef; padding: 7px 11px; border-radius: 6px; font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.topbar nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.25); font-weight: 700; }
.topbar nav a.soon { opacity:.72; }
/* Badge số đếm trên tab (kiểu eOffice): xám mờ; đỏ khi có việc trễ hạn */
.navbadge { display:inline-block; min-width:18px; padding:0 5px; height:18px; line-height:18px; text-align:center;
  font-size:12px; font-weight:700; border-radius:9px; background:rgba(255,255,255,.30); color:#fff;
  margin-left:6px; vertical-align:1px; }
.navbadge.red { background:#e74c3c; color:#fff; box-shadow:0 0 0 1px rgba(255,255,255,.25) inset; }
.topbar .spacer { flex: 1; }
/* Menu người dùng (gập) */
.usermenu { position: relative; }
.usermenu > summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:10px; padding:5px 9px; border-radius:8px; color:#fff; }
.usermenu > summary::-webkit-details-marker { display:none; }
.usermenu > summary:hover { background: rgba(255,255,255,.12); }
.um-name { text-align:right; line-height:1.2; }
.um-name b { display:block; font-size:14.5px; font-weight:700; white-space:nowrap; }
.um-role { font-size:12px; opacity:.85; white-space:nowrap; }
.um-caret { font-size:13px; opacity:.9; }
.um-pop { position:absolute; right:0; top:100%; margin-top:8px; background:#fff; border-radius:8px; box-shadow:0 8px 22px rgba(0,0,0,.28); min-width:190px; overflow:hidden; z-index:60; }
.um-pop a { display:block; padding:12px 18px; color:#1f2733; font-size:15px; font-weight:500; cursor:pointer; }
.um-pop a:hover { background:#eef1f4; text-decoration:none; }
.um-pop a + a { border-top:1px solid #eef1f4; }
.um-ava { display:none; font-size:18px; }
.um-head { display:none; padding:12px 18px; border-bottom:1px solid #eef1f4; line-height:1.35; }
.um-head b { display:block; font-size:14px; color:#1f2733; }
.um-head span { font-size:12px; color:#6b7785; }

.wrap { max-width: 1200px; margin: 20px auto; padding: 0 16px; }
h1 { font-size: 25px; margin-bottom: 4px; color: #163a20; font-weight: 800; }
.h1-date { font-size: 14px; font-weight: 500; color: #6b7785; margin-left: 8px; }
h2 { font-size: 19px; margin: 16px 0 10px; color: #1f4e2c; font-weight: 700; }
h3 { font-size: 16.5px; margin: 4px 0; color: #1f2733; }
.muted { color: #6b7785; font-size: 13px; }
.c { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 10px; margin: 12px 0 6px; }
.card { background: #fff; border-radius: 10px; padding: 12px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-left: 4px solid #1f4e2c; }
.card .num { font-size: 26px; font-weight: 700; color: #163a20; line-height: 1.05; }
.card .lbl { font-size: 13px; font-weight: 600; color: #37424f; margin-top: 2px; }
.card.warn { border-left-color:#c0392b; } .card.warn .num { color:#c0392b; }
.card.ok { border-left-color:#1e8449; } .card.ok .num { color:#1e8449; }
.card.info { border-left-color:#2471a3; } .card.info .num { color:#2471a3; }
/* 5 ô tổng hợp ở đầu trang: số + nhãn cùng một hàng cho gọn chiều cao */
.card-tab { cursor:pointer; transition: box-shadow .15s, transform .12s; user-select:none;
  display:flex; align-items:baseline; gap:9px; padding:9px 14px; }
.card-tab .num { font-size: 22px; }
.card-tab .lbl { margin-top:0; }
.card-tab:hover { box-shadow:0 4px 12px rgba(0,0,0,.16); transform:translateY(-2px); }
.card-tab.active { outline:2px solid #1f4e2c; outline-offset:1px; box-shadow:0 4px 12px rgba(0,0,0,.16); }

/* Panels & tables */
.panel { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 18px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #e6e9ed; vertical-align: top; }
th { background: #f4f6f8; color: #41505f; font-weight: 600; font-size: 13px; white-space: nowrap; }
tr:hover td { background: #fafbfc; }
tr.subrow td { background: #f8fbf8; }

/* Badges */
.badge { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; white-space:nowrap; }
.b-chua{background:#eceff1;color:#546e7a;} .b-dang{background:#e3f2fd;color:#1565c0;}
.b-xong{background:#e8f5e9;color:#2e7d32;} .b-tam{background:#fff3e0;color:#e65100;}
.b-tre{background:#fdecea;color:#c0392b;} .b-gap{background:#c0392b;color:#fff;}
.b-quan{background:#e67e22;color:#fff;} .b-thuong{background:#eceff1;color:#607d8b;}
.b-src{background:#ede7f6;color:#5e35b1;} .b-cap{background:#e0f2f1;color:#00695c;}

/* Forms */
label { display:block; font-size:13px; font-weight:600; color:#41505f; margin-bottom:4px; }
input[type=text],input[type=password],input[type=date],select,textarea {
  width:100%; padding:8px 10px; border:1px solid #cfd6dd; border-radius:6px; font-size:14px; font-family:inherit; background:#fff; }
textarea { resize: vertical; min-height: 58px; }
.form-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:12px; }
.btn { display:inline-block; background:#1f4e2c; color:#fff; border:none; padding:9px 18px; border-radius:6px; font-size:14px; cursor:pointer; font-family:inherit; font-weight:600; }
.btn:hover { background:#163a20; text-decoration:none; }
.btn.sm { padding:5px 10px; font-size:13px; }
.btn.gray{background:#607d8b;} .btn.gray:hover{background:#455a64;}
.btn.red{background:#c0392b;} .btn.red:hover{background:#922b21;}
.btn.ghost{background:#fff;color:#1f4e2c;border:1px solid #1f4e2c;}
.inline{display:inline;}

/* Flash */
.flash { padding:11px 16px; border-radius:8px; margin-bottom:14px; font-size:14px; }
.flash.ok { background:#e8f5e9; color:#2e7d32; border:1px solid #a5d6a7; }
.flash.error { background:#fdecea; color:#c0392b; border:1px solid #f5b7b1; }

/* Login */
.login-bg { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#163a20,#1f4e2c); padding:16px; }
.login-box { background:#fff; padding:32px; border-radius:14px; width:370px; max-width:100%; box-shadow:0 10px 40px rgba(0,0,0,.3); }
.login-box h1 { text-align:center; font-size:20px; margin-bottom:4px; }
.login-box .sub { text-align:center; color:#6b7785; font-size:13px; margin-bottom:20px; }
.login-box .field { margin-bottom:14px; }
.login-box .btn { width:100%; padding:11px; }
.hint { margin-top:16px; font-size:12px; color:#90a4ae; text-align:center; line-height:1.7; }

.feed { list-style:none; font-size:14px; } .feed li { padding:7px 0; border-bottom:1px solid #eef1f4; }

/* Modal (đổi mật khẩu) */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; z-index:120; padding:16px; }
.modal-overlay[hidden] { display:none; }
.modal { background:#fff; border-radius:12px; padding:22px; width:360px; max-width:100%; box-shadow:0 12px 40px rgba(0,0,0,.3); }
.modal h2 { margin:0 0 12px; }
.modal .field { margin-bottom:12px; }

/* Toast thông báo (tự ẩn) */
.toast-wrap { position:fixed; top:62px; left:50%; transform:translateX(-50%); z-index:200; width:min(440px,92%); }
.toast-wrap .flash { box-shadow:0 4px 16px rgba(0,0,0,.18); }

/* RESPONSIVE - điện thoại */
@media (max-width: 820px) {
  .burger { display:block; }
  .topbar nav { display:none; position:absolute; top:52px; left:0; right:0; flex-direction:column; background:#1f4e2c; padding:6px; gap:2px; box-shadow:0 6px 12px rgba(0,0,0,.2); }
  #navtoggle:checked ~ .topbar nav { display:flex; }
  .topbar nav a { padding:12px 14px; }
  .topbar .brand small { display:none; }
  .topbar .brand { font-size:15px; }
  .um-name { display:none; }            /* ẩn tên/chức danh ở header → tránh tràn ngang */
  .um-ava { display:inline-block; }     /* thay bằng icon gọn */
  .um-head { display:block; }           /* tên/chức danh đầy đủ hiện trong menu */
  .grid2 { grid-template-columns:1fr; }
  h1 { font-size:20px; }
}

/* ===== Thành phần trang Việc của tôi / Báo cáo / Tổ chức ===== */
/* Toolbar / pills / progress / tree */
.toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.toolbar .spacer { flex:1; }
.pill { padding:6px 13px; border-radius:20px; background:#fff; border:1px solid #cfd6dd; font-size:13px; cursor:pointer; font-family:inherit; }
.pill.active { background:#1f4e2c; color:#fff; border-color:#1f4e2c; }
.progress { background:#e6e9ed; border-radius:10px; height:8px; overflow:hidden; min-width:70px; }
.progress > span { display:block; height:100%; background:#1e8449; }
.tree { list-style:none; margin-top:6px; font-size:14px; }
.tree li { padding:3px 0; } .tree .lvl-phong { padding-left:18px; } .tree .lvl-ban { padding-left:36px; }

/* Cập nhật trong thẻ việc */
.upd { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.upd select { width:auto; } .upd input { flex:1; min-width:120px; }
.row-edit { margin-top:8px; } .row-edit summary { cursor:pointer; color:#2471a3; font-size:13px; }
.row-edit form { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.row-edit form input, .row-edit form select { width:auto; }
.mt { margin-top:8px; }
.subs { margin-top:12px; padding-top:10px; border-top:1px dashed #d6dde3; }
.sub { display:flex; align-items:center; gap:8px; padding:5px 0; flex-wrap:wrap; }
.sub-mark { color:#1f4e2c; font-weight:700; }
.sub-title { flex:0 1 auto; } .sub-title.done { text-decoration:line-through; color:#9aa6b2; }
.sub-upd { display:inline-flex; gap:4px; } .sub-upd select { width:auto; padding:3px 6px; }
.add-sub { display:flex; gap:8px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.add-sub input[type=text] { flex:1; min-width:200px; }
.add-sub input[data-date] { width:auto; }

/* Tabs */
.tabs { display:flex; gap:4px; margin:14px 0 16px; border-bottom:2px solid #d6dde3; flex-wrap:wrap; }
.tab { background:none; border:none; padding:10px 16px; font-size:15px; font-weight:600; color:#6b7785; cursor:pointer; border-bottom:3px solid transparent; margin-bottom:-2px; font-family:inherit; }
.tab:hover { color:#1f4e2c; }
.tab.active { color:#1f4e2c; border-bottom-color:#1f4e2c; }

/* To-do (Hôm nay) */
.todo { list-style:none; }
.todo-item { display:flex; align-items:center; gap:12px; padding:11px 6px; border-bottom:1px solid #eef1f4; }
.todo-main { flex:1; min-width:0; }
.todo-title { font-weight:700; font-size:16.5px; }
.todo-main .muted { margin-left:8px; font-weight:400; }
.todo-meta { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.status-quick { display:inline; margin:0; }
.status-quick select { width:auto; padding:4px 8px; font-size:13px; font-weight:600; border-radius:6px; cursor:pointer; }
.todo-item.done .todo-title.done { text-decoration:line-through; color:#9aa6b2; font-weight:400; }
.done-list { opacity:.85; }
.cbox { width:22px; height:22px; min-width:22px; border:2px solid #9bb3a3; border-radius:6px; background:#fff; cursor:pointer; padding:0; }
.cbox:hover { border-color:#1f4e2c; background:#e8f5e9; }
.cbox.checked { border-color:#2e7d32; background:#2e7d32; color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:14px; }
.tick { display:flex; }

/* Hộp thêm việc (gập) */
.addbox { background:#fff; border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,.08); padding:0; }
.addbox > summary { padding:14px 18px; font-size:16px; font-weight:700; color:#1f4e2c; cursor:pointer; list-style:none; }
.addbox > summary::-webkit-details-marker { display:none; }
.addbox > summary::before { content:'▸ '; }
.addbox[open] > summary::before { content:'▾ '; }
.addbox-body { padding:0 18px 18px; }

/* Thẻ công việc (gập) */
.taskitem { background:#fff; border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,.08); margin-bottom:10px; }
.taskitem > summary { padding:13px 16px; cursor:pointer; display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; list-style:none; }
.taskitem > summary::-webkit-details-marker { display:none; }
.taskitem > summary::before { content:'▸'; color:#9aa6b2; margin-right:4px; }
.taskitem[open] > summary::before { content:'▾'; }
.ti-title { font-weight:700; font-size:16.5px; flex:1; min-width:140px; }
.ti-title.done { text-decoration:line-through; color:#9aa6b2; font-weight:400; }
.ti-meta { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.taskbody { padding:4px 16px 16px; border-top:1px dashed #e0e6ea; }

/* Nhật ký */
.diary-day { margin-bottom:14px; }
.diary-day h3 { font-size:15px; color:#1f4e2c; border-bottom:1px solid #eef1f4; padding-bottom:4px; }
.diary-list { list-style:none; margin-top:6px; }
.diary-list li { padding:6px 0; font-size:14px; border-bottom:1px solid #f4f6f8; }

@media print {
  .topbar, .toolbar, form, .btn { box-shadow:none; }
  .topbar, .toolbar, .row-edit, .add-sub { display:none !important; }
  .panel { box-shadow:none; border:1px solid #ccc; }
}

/* ===== Tải dữ liệu / lỗi tải (bổ sung sau rà soát 06/2026) ===== */
.page-loading { position:fixed; inset:0; background:rgba(238,241,244,.85); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:14px; z-index:300; color:#1f4e2c; font-weight:600; }
.spin { width:42px; height:42px; border:4px solid #cfd9d0; border-top-color:#1f4e2c; border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.errbox { max-width:680px; margin:40px auto; border-left:4px solid #c0392b; }
.errbox .btn { margin-top:10px; }
.page-in { animation: page-in .2s ease-out; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* Hộp địa chỉ kiosk (Bảng tin) — dễ đọc, 1 click chọn cả URL */
code { font-family:"Consolas","Courier New",monospace; font-size:13px; }
.copybox { display:inline-block; background:#f4f6f8; border:1px solid #cfd6dd; border-radius:6px;
  padding:4px 8px; word-break:break-all; user-select:all; max-width:100%; }

/* Bảng nhiều cột trên điện thoại nhỏ: thu nhỏ chữ cho đỡ phải cuộn ngang */
@media (max-width: 560px) {
  table { font-size: 12.5px; }
  th, td { padding: 6px 7px; }
  .col-opt { display: none; }   /* ẩn cột phụ trên màn hẹp, giữ cột then chốt + Tỷ lệ HT */
}
