/* Nhóm công việc — giao diện ưu tiên điện thoại, mở rộng cho máy tính. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --xanh: #1f4e2c; --xanh-dam: #163a20; --nen: #eef1f4; --chu: #1f2733; --mo: #6b7785; --vien: #dde3e8; --do: #c0392b; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--nen); color: var(--chu); font-size: 15.5px; line-height: 1.45; }
body.noscroll { overflow: hidden; }
a { color: var(--xanh); text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- Thanh trên ---------- */
.topbar { background: linear-gradient(90deg, var(--xanh-dam), var(--xanh)); color: #fff; height: 54px; padding: 0 14px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.brand { font-weight: 800; font-size: 16px; line-height: 1.1; white-space: nowrap; }
.brand small { display: block; font-weight: 600; font-size: 11.5px; opacity: .85; }
.topnav { display: flex; gap: 2px; margin-left: 10px; flex: 1; }
.topnav a { color: #eef5ef; padding: 7px 11px; border-radius: 6px; font-size: 14.5px; font-weight: 600; white-space: nowrap; position: relative; }
.topnav a .ni { display: none; }
.topnav a:hover { background: rgba(255,255,255,.12); }
.topnav a.active { background: rgba(255,255,255,.25); }
.navbadge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px;
  background: #e74c3c; color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; margin-left: 5px; }
.usermenu { position: relative; margin-left: auto; }
.usermenu > summary { list-style: none; cursor: pointer; }
.usermenu > summary::-webkit-details-marker { display: none; }
.ava { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--xanh);
  align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.um-pop { position: absolute; right: 0; top: 44px; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.28); min-width: 220px; overflow: hidden; z-index: 60; }
.um-head { padding: 12px 16px; border-bottom: 1px solid var(--nen); color: var(--chu); }
.um-head b { display: block; font-size: 14.5px; } .um-head span { font-size: 12.5px; color: var(--mo); }
.um-pop a { display: block; padding: 12px 16px; color: var(--chu); cursor: pointer; }
.um-pop a:hover { background: var(--nen); }

/* Thanh dưới (điện thoại) */
.bottomnav { display: none; }
@media (max-width: 820px) {
  .topnav { display: none; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: #fff;
    border-top: 1px solid var(--vien); box-shadow: 0 -2px 8px rgba(0,0,0,.08); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 2px 5px; color: var(--mo);
    font-size: 11px; font-weight: 600; position: relative; }
  .bottomnav a .ni { font-size: 20px; line-height: 1.2; }
  .bottomnav a.active { color: var(--xanh); }
  .bottomnav a.active .ni { transform: scale(1.1); }
  .bottomnav .navbadge { position: absolute; top: 2px; left: 54%; margin: 0; }
  body { padding-bottom: 70px; }
}

/* ---------- Khung trang ---------- */
.wrap { max-width: 1100px; margin: 16px auto; padding: 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
h1 { font-size: 22px; color: var(--xanh-dam); font-weight: 800; }
h2 { font-size: 17px; color: var(--xanh); margin: 0 0 10px; font-weight: 700; }
h3 { font-size: 15.5px; margin: 0 0 6px; }
.muted { color: var(--mo); font-size: 13.5px; }
.panel { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.empty { text-align: center; color: var(--mo); padding: 18px 8px; font-size: 14px; }
.loading { text-align: center; color: var(--mo); padding: 30px; }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #cfd8dc;
  border-top-color: var(--xanh); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.errbox h2 { color: var(--do); }

/* Ô số tổng hợp */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-left: 4px solid var(--xanh); }
.stat .num { font-size: 24px; font-weight: 800; color: var(--xanh-dam); line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: #4a5562; font-weight: 600; }
.stat.warn { border-color: var(--do); } .stat.warn .num { color: var(--do); }
.stat.info { border-color: #2471a3; } .stat.info .num { color: #2471a3; }
.stat.ok { border-color: #1e8449; } .stat.ok .num { color: #1e8449; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Thẻ thành viên (Tổng quan của trưởng nhóm) */
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.person { background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: block; color: inherit; }
.person .p-name { font-weight: 700; } .person .p-area { font-size: 12.5px; color: var(--mo); margin-bottom: 8px; }
.person .p-nums { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.person .p-nums b { font-size: 16px; }
.red { color: var(--do); }

/* Thẻ công việc */
.tasklist { display: flex; flex-direction: column; gap: 8px; }
.task { display: block; background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.07);
  border-left: 4px solid #90a4ae; color: inherit; }
.task:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.task.overdue { border-left-color: var(--do); }
.task.is-done { border-left-color: #1e8449; opacity: .85; }
.panel .task { box-shadow: none; border: 1px solid var(--vien); border-left-width: 4px; }
.t-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.t-title { font-weight: 650; font-size: 15px; }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.8px; color: var(--mo); margin-top: 4px; align-items: center; }
.t-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.t-flags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.bar { flex: 1; height: 8px; background: #e6eaee; border-radius: 4px; overflow: hidden; max-width: 320px; }
.bar i { display: block; height: 100%; background: #2e86c1; border-radius: 4px; }
.bar.done i { background: #1e8449; }
.pct { font-size: 12.5px; font-weight: 700; color: #455a64; min-width: 34px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.8px; 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: var(--do); } .b-gap { background: var(--do); color: #fff; }
.b-uu { background: #e67e22; color: #fff; } .b-src { background: #ede7f6; color: #5e35b1; }
.b-new { background: #fdecea; color: var(--do); } .b-rev { background: #fff8e1; color: #b26a00; }
.b-res { background: #e8f5e9; color: #2e7d32; } .b-rej { background: #eceff1; color: #546e7a; }
.flag { font-size: 11.8px; font-weight: 600; padding: 1px 8px; border-radius: 5px; }
.f-nhan { background: #fff3e0; color: #e65100; } .f-moi { background: #fce4ec; color: #ad1457; } .f-cu { background: #fff8e1; color: #8d6e00; }

/* Bộ lọc dạng nút */
.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.pill { border: 1px solid var(--vien); background: #fff; border-radius: 20px; padding: 6px 12px; font-size: 13.5px; font-weight: 600;
  color: #455a64; white-space: nowrap; cursor: pointer; font-family: inherit; }
.pill.active { background: var(--xanh); color: #fff; border-color: var(--xanh); }
.pill .c { opacity: .75; margin-left: 3px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar select, .toolbar input { width: auto; min-width: 160px; flex: 1; max-width: 320px; }

/* ---------- Biểu mẫu ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #41505f; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cfd6dd; border-radius: 8px; font-size: 16px; font-family: inherit; background: #fff; color: inherit; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a5d6a7; border-color: var(--xanh); }
.field { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; gap: 0; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--xanh); color: #fff; border: none;
  padding: 10px 18px; border-radius: 8px; font-size: 15px; cursor: pointer; font-family: inherit; font-weight: 600; }
.btn:hover { background: var(--xanh-dam); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }
.btn.gray { background: #607d8b; } .btn.red { background: var(--do); }
.btn.ghost { background: #fff; color: var(--xanh); border: 1px solid var(--xanh); }
.btn.block { width: 100%; }
.hint-safe { font-size: 12.5px; color: #8d6e00; background: #fffbea; border-radius: 6px; padding: 6px 10px; margin-bottom: 12px; }
.range { display: flex; align-items: center; gap: 10px; }
.range input[type=range] { flex: 1; accent-color: var(--xanh); height: 28px; }
.range output { font-weight: 800; font-size: 18px; min-width: 52px; text-align: right; color: var(--xanh-dam); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--xanh); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; transition: opacity .4s; }
.flash.ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash.error { background: #fdecea; color: var(--do); border: 1px solid #f5b7b1; }
.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); }

/* Hộp thoại: điện thoại = trượt từ dưới lên, toàn chiều rộng */
.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 { background: #fff; border-radius: 14px; width: 620px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.modal-head h2 { margin: 0; }
.modal-head .x { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--mo); padding: 4px 8px; }
.modal-body { padding: 4px 16px 16px; overflow-y: auto; }
@media (max-width: 560px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; width: 100%; }
  .modal-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* Chi tiết công việc */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14.5px; }
.kv dt { color: var(--mo); font-weight: 600; } .kv dd { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }
.box-text { background: #f6f8fa; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.timeline { list-style: none; }
.timeline li { border-left: 3px solid #cfd8dc; padding: 2px 0 12px 12px; margin-left: 6px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 3px solid #2e86c1; }
.timeline .when { font-size: 12.5px; color: var(--mo); }
.timeline .diff { color: #a04000; }
.stickybar { margin: 0 0 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Việc hằng ngày */
.todo-day { margin-bottom: 4px; }
.todo-list { list-style: none; }
.todo-list li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #eef1f4; }
.todo-list li input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--xanh); }
.todo-list li .tt { flex: 1; word-break: break-word; }
.todo-list li.done .tt { text-decoration: line-through; color: var(--mo); }
.todo-list li .link { font-size: 12px; color: var(--mo); display: block; }
.todo-list li .del { border: none; background: none; color: #b0bec5; font-size: 18px; cursor: pointer; padding: 2px 6px; }
.addline { display: flex; gap: 8px; margin-top: 10px; }
.addline input { flex: 1; }
.datenav { display: flex; align-items: center; gap: 8px; }
.datenav button { border: 1px solid var(--vien); background: #fff; border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.datenav .d { font-weight: 700; min-width: 150px; text-align: center; }

/* Đề xuất */
.prop { border: 1px solid var(--vien); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.prop .p-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--mo); }
.prop .p-body { margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
.prop .p-resp { background: #f1f8e9; border-radius: 8px; padding: 8px 10px; font-size: 14px; white-space: pre-wrap; }
.prop .p-resp b { color: var(--xanh); }

/* Báo cáo */
.rep-sec { margin-bottom: 16px; }
.rep-sec h3 { color: var(--xanh); border-bottom: 2px solid #e8f5e9; padding-bottom: 4px; margin-bottom: 8px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; 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; }

/* Đăng nhập */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--xanh-dam), var(--xanh)); padding: 16px; }
.login-box { background: #fff; padding: 28px 24px; border-radius: 16px; width: 380px; max-width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h1 { text-align: center; font-size: 21px; } .login-box .sub { text-align: center; color: var(--mo); font-size: 13px; margin: 4px 0 18px; }
.login-box .btn { width: 100%; padding: 12px; }
.hint { margin-top: 14px; font-size: 12.5px; color: #90a4ae; text-align: center; }
a.stat { display: block; color: inherit; }
a.stat[href]:hover { box-shadow: 0 4px 12px rgba(0,0,0,.14); }
