/* =========================================================
   Hệ thống Quản lý Công việc — Giao diện
   ========================================================= */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --text: #1e2233;
  --text-soft: #5b6178;
  --text-muted: #8b90a5;
  --border: #e6e8f0;
  --border-strong: #d4d7e3;
  --green: #16a34a;  --green-bg: #dcfce7;
  --amber: #d97706;  --amber-bg: #fef3c7;
  --red: #dc2626;    --red-bg: #fee2e2;
  --blue: #2563eb;   --blue-bg: #dbeafe;
  --gray-bg: #eceef4;
  --shadow-sm: 0 1px 2px rgba(20,23,40,.06);
  --shadow: 0 4px 16px rgba(20,23,40,.08);
  --shadow-lg: 0 12px 40px rgba(20,23,40,.14);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { vertical-align: -3px; flex-shrink: 0; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: #11132b;
  color: #c5c9e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform .25s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #7c6cf0);
  color: #fff; font-weight: 800; font-size: 16px;
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(79,70,229,.45);
}
.brand-name { font-weight: 700; color: #fff; font-size: 15px; line-height: 1.25; }
.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b6f8e; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 11px;
  color: #c5c9e0; font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.4); }
.nav-item .badge-count {
  margin-left: auto; background: rgba(255,255,255,.16); color:#fff;
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px;
}
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.nav-item.logout:hover { background: rgba(220,38,38,.22); color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 26px; min-height: 64px;
}
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-meta { text-align: right; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c6cf0);
  color: #fff; font-weight: 700; display: grid; place-items: center; flex-shrink: 0;
}
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 10px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; color: var(--text);
}
.content { padding: 26px; max-width: 1240px; width: 100%; }

/* ---------------- Tiêu đề trang ---------------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 23px; margin: 0 0 4px; font-weight: 750; }
.page-head .sub { color: var(--text-soft); font-size: 14px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card-head h2 { font-size: 16px; margin: 0; font-weight: 700; }
.card-head .actions { margin-left: auto; }

/* ---------------- Lưới thống kê ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .stat-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
}
.stat .num { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { color: var(--text-soft); font-size: 13.5px; margin-top: 5px; }
.ico-indigo { background: var(--primary-light); color: var(--primary); }
.ico-green  { background: var(--green-bg); color: var(--green); }
.ico-amber  { background: var(--amber-bg); color: var(--amber); }
.ico-red    { background: var(--red-bg); color: var(--red); }
.ico-blue   { background: var(--blue-bg); color: var(--blue); }

/* ---------------- Badge ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 30px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg); color: var(--red); }
.badge-blue  { background: var(--blue-bg); color: var(--blue); }
.badge-gray  { background: var(--gray-bg); color: var(--text-soft); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------------- Bảng ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; padding: 12px 16px; color: var(--text-muted);
  font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: #fafbff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.t-title { font-weight: 600; color: var(--text); }
.t-title a { color: var(--text); }
.t-title a:hover { color: var(--primary); }
.t-sub { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s; white-space: nowrap;
  font-family: inherit; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: #f7f8fc; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.field .req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong);
  border-radius: 11px; font-size: 14.5px; font-family: inherit; color: var(--text);
  background: var(--surface); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
textarea { resize: vertical; min-height: 96px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b90a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }

/* ---------------- Alerts ---------------- */
.alert {
  padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px;
  display: flex; align-items: center; gap: 10px; border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: #166534; border-color: #bbf7d0; }
.alert-error   { background: var(--red-bg); color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--blue-bg); color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }

/* ---------------- Progress ---------------- */
.progress { height: 8px; background: var(--gray-bg); border-radius: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #7c6cf0); border-radius: 20px; transition: width .3s; }
.progress.done > span { background: linear-gradient(90deg, var(--green), #22c55e); }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty .empty-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--gray-bg); color: var(--text-muted); display: grid; place-items: center; margin: 0 auto 16px; }
.empty h3 { color: var(--text-soft); margin: 0 0 4px; font-size: 16px; }

/* ---------------- Filter bar ---------------- */
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filterbar .search { position: relative; flex: 1; min-width: 200px; }
.filterbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.filterbar .search input { padding-left: 38px; }
.filterbar select { width: auto; min-width: 150px; }

/* ---------------- Chi tiết công việc ---------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.meta-list { display: flex; flex-direction: column; gap: 2px; }
.meta-list .row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.meta-list .row:last-child { border-bottom: none; }
.meta-list .row .k { color: var(--text-muted); display: flex; align-items: center; gap: 8px; min-width: 116px; }
.meta-list .row .v { font-weight: 600; margin-left: auto; text-align: right; }

/* ---------------- Dòng thời gian báo cáo ---------------- */
.thread { display: flex; flex-direction: column; gap: 16px; }
.report {
  display: flex; gap: 14px;
}
.report .av { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg,#7c6cf0,var(--primary)); color:#fff; display:grid; place-items:center; font-weight:700; font-size: 14px; }
.report.is-manager .av { background: linear-gradient(135deg, #f59e0b, #d97706); }
.report-body { flex: 1; background: #fafbff; border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; }
.report-body .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.report-body .who { font-weight: 600; font-size: 14px; }
.report-body .when { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.report-body .txt { font-size: 14px; white-space: pre-wrap; color: var(--text); }

/* ---------------- Tệp đính kèm ---------------- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.attach {
  border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--surface);
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.attach:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.attach .thumb { aspect-ratio: 16/10; background: #0d0f24; display: grid; place-items: center; color: #fff; overflow: hidden; }
.attach .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach .thumb video { width: 100%; height: 100%; object-fit: cover; }
.attach .thumb .ph { color: var(--primary); }
.attach .meta { padding: 8px 10px; }
.attach .nm { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach .sz { font-size: 11.5px; color: var(--text-muted); }
.attach .kind-badge { position: absolute; }

/* file picker preview */
.uploader { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 22px; text-align: center; transition: border .15s, background .15s; cursor: pointer; background: #fafbff; }
.uploader:hover { border-color: var(--primary); background: var(--primary-light); }
.uploader .icon { color: var(--primary); }
.uploader .big { font-weight: 600; margin: 8px 0 2px; }
.uploader .small { font-size: 12.5px; color: var(--text-muted); }
.uploader input[type=file] { display: none; }
.file-preview { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-preview .fp-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.file-preview .fp-item .fp-rm { margin-left: auto; color: var(--text-muted); cursor: pointer; background: none; border: none; padding: 4px; }
.file-preview .fp-item .fp-rm:hover { color: var(--red); }

/* ---------------- Trang đăng nhập ---------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, #e9e7ff 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 110%, #dbeafe 0%, transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 38px 34px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.auth-brand .brand-logo { width: 46px; height: 46px; font-size: 18px; }
.auth-card h1 { text-align: center; font-size: 21px; margin: 16px 0 4px; }
.auth-card .sub { text-align: center; color: var(--text-soft); margin-bottom: 26px; font-size: 14px; }
.auth-card .field { margin-bottom: 16px; }

/* ---------------- Tiện ích ---------------- */
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-0{margin-top:0} .mt-8{margin-top:8px} .mt-16{margin-top:16px} .mt-24{margin-top:24px}
.mb-0{margin-bottom:0} .mb-16{margin-bottom:16px} .mb-24{margin-bottom:24px}
.muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.fw-600 { font-weight: 600; }
.fs-13 { font-size: 13px; } .fs-12 { font-size: 12px; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.overlay-bg { display: none; position: fixed; inset: 0; background: rgba(15,17,40,.45); z-index: 40; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; place-items: center; }
  .content { padding: 18px 16px; }
  .topbar { padding: 10px 16px; }
  .user-meta { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .overlay-bg.show { display: block; }
  .page-head .actions { width: 100%; }
}

/* ============================================================
   LỊCH LÀM VIỆC THEO TUẦN
   ============================================================ */
.sched-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.sched-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: start; }
.sched-col { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; min-height: 130px; box-shadow: var(--shadow-sm); }
.sched-col.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.sched-day { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sched-day-name { font-weight: 700; font-size: 13px; }
.sched-day-date { font-size: 12px; color: var(--text-muted); }
.sched-col.today .sched-day-date { color: var(--primary); font-weight: 600; }
.sched-items { display: flex; flex-direction: column; gap: 6px; padding: 8px; flex: 1; }
.sched-entry { border-left: 4px solid var(--primary); background: #fafbff; border-radius: 8px; padding: 7px 9px; }
.sched-entry.clickable { cursor: pointer; transition: background .12s; }
.sched-entry.clickable:hover { background: #eef2ff; }
.sched-time { font-size: 11.5px; font-weight: 700; color: var(--text-soft); }
.sched-title { font-size: 13.5px; font-weight: 600; color: var(--text); word-break: break-word; }
.sched-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: pre-wrap; }
.sched-add { margin: 0 8px 8px; background: transparent; border: 1px dashed var(--border-strong); color: var(--text-muted); border-radius: 8px; padding: 6px; cursor: pointer; font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.sched-add:hover { border-color: var(--primary); color: var(--primary); }

.smodal-overlay { position: fixed; inset: 0; background: rgba(15,17,40,.55); z-index: 60; display: grid; place-items: center; padding: 20px; }
.smodal-overlay[hidden] { display: none; }
.rpt-owner-head { font-weight: 700; font-size: 14px; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.rpt-owner-head:first-child { margin-top: 0; }
/* Lọc + gập nhóm theo nhân viên (tối ưu cuộn khi nhiều người báo cáo) */
.rpt-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; color: var(--text-soft); }
.rpt-filter input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; font-family: inherit; color: var(--text); min-width: 0; }
.rpt-owner-group { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--surface); overflow: hidden; }
.rpt-owner-group > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; margin: 0; font-weight: 700; font-size: 14px; }
.rpt-owner-group > summary::-webkit-details-marker { display: none; }
.rpt-owner-group > summary::after { content: '▸'; color: var(--text-soft); font-size: 13px; transition: transform .15s; }
.rpt-owner-group[open] > summary::after { transform: rotate(90deg); }
.rpt-owner-group[open] > summary { border-bottom: 1px solid var(--border); }
.rpt-owner-group > summary:hover { background: var(--gray-bg); }
.rpt-owner-name { display: flex; align-items: center; gap: 6px; }
.rpt-owner-group .rpt-folders { padding: 14px; margin: 0; }
.smodal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; }
.smodal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.smodal-head h2 { margin: 0; font-size: 16px; flex: 1; }
.kx { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.smodal form { padding: 16px 20px; }
.smodal .field { margin-bottom: 12px; }
.smodal-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.smodal-foot .btn-ghost { margin-left: auto; }
.sched-colors { display: flex; gap: 8px; }
.sched-sw { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; position: relative; }
.sched-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sched-sw:has(input:checked) { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); }

@media (max-width: 1100px) { .sched-grid { grid-template-columns: repeat(4, minmax(170px, 1fr)); overflow-x: auto; } }
@media (max-width: 700px) { .sched-grid { grid-template-columns: 1fr; } }

/* ============================================================
   BÁO CÁO THEO THƯ MỤC
   ============================================================ */
.rpt-pop { position: relative; display: inline-block; }
.rpt-pop > summary { list-style: none; cursor: pointer; }
.rpt-pop > summary::-webkit-details-marker { display: none; }
.rpt-pop-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: auto; width: 290px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px; }
.actions .rpt-pop-panel, .rpt-folder-menu .rpt-pop-panel { left: auto; right: 0; }
.rpt-pop-panel input[type=text], .rpt-pop-panel select, .rpt-pop-panel textarea { width: 100%; }
.rpt-pop-panel .field span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.rpt-pop-panel .field { margin-bottom: 10px; }

.rpt-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 8px; }
.rpt-folder { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.rpt-folder:hover { box-shadow: var(--shadow); }
.rpt-folder-main { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 14px 40px 14px 14px; color: var(--text); }
.rpt-folder-main:hover { text-decoration: none; }
.rpt-folder-ico { grid-row: 1 / 3; color: var(--amber); }
.rpt-folder-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpt-folder-meta { font-size: 12px; color: var(--text-muted); }
.rpt-folder-menu { position: absolute; top: 8px; right: 6px; }
.rpt-folder-menu .kx { padding: 2px 8px; border-radius: 6px; }
.rpt-folder-menu .rpt-pop-panel input[type=text] { width: 100%; }

.rpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rpt-img { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); transition: box-shadow .15s, transform .15s; }
.rpt-img:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.rpt-thumb { aspect-ratio: 1 / 1; background: #0d0f24; display: grid; place-items: center; color: #fff; overflow: hidden; }
.rpt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rpt-img-foot { padding: 8px; }
.rpt-cap-prev { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.3; }

.rpt-flow-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rpt-flow-head strong { flex: 1; display: inline-flex; align-items: center; gap: 6px; }
.rpt-stages { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rpt-stage { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; background: var(--gray-bg); color: var(--text-muted); }
.rpt-stage-no { width: 20px; height: 20px; border-radius: 50%; background: var(--border-strong); color: #fff; display: grid; place-items: center; font-size: 11px; }
.rpt-stage.cur { background: var(--primary-light); color: var(--primary); }
.rpt-stage.cur .rpt-stage-no { background: var(--primary); }
.rpt-stage.past { background: var(--green-bg); color: var(--green); }
.rpt-stage.past .rpt-stage-no { background: var(--green); }
.linkx { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.linkx:hover { color: var(--red); }

.rpt-log { display: flex; flex-direction: column; gap: 8px; }
.rpt-log-row { display: flex; gap: 10px; font-size: 13.5px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.rpt-log-row:last-child { border-bottom: none; }
.rpt-log-act { flex: 1; }
.rpt-log-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.rpt-radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ============================================================
   KẾ HOẠCH (bảng động)
   ============================================================ */
.plan-switch { display: inline-flex; gap: 4px; background: var(--gray-bg); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.plan-switch-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--text-soft); }
.plan-switch-btn:hover { text-decoration: none; color: var(--text); }
.plan-switch-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.plan-card:hover { box-shadow: var(--shadow); }
.plan-card-main { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 14px 40px 14px 14px; color: var(--text); }
.plan-card-main:hover { text-decoration: none; }
.plan-card-ico { grid-row: 1 / 3; color: var(--primary); }
.plan-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-card-meta { font-size: 12px; color: var(--text-muted); }
.plan-card-del { position: absolute; top: 8px; right: 6px; }

.plan-title-input { font-size: 22px; font-weight: 750; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; max-width: 420px; width: 100%; }
.plan-title-input:focus { border-color: var(--primary); outline: none; }
.plan-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.plan-wrap .table-wrap { overflow: auto; max-height: calc(100vh - 250px); }
.plan-table { border-collapse: collapse; min-width: 100%; }
.plan-table th { white-space: nowrap; position: sticky; top: 0; z-index: 2; background: var(--gray-bg); border: 1px solid var(--border-strong); padding: 0; }
.plan-table td { padding: 0; border: 1px solid var(--border); vertical-align: middle; }
.plan-table tbody tr:hover td { background: #f6f8ff; }
.plan-table input, .plan-table select, .plan-table textarea { width: 100%; min-width: 0; border: none; border-radius: 0; padding: 8px 10px; font-size: 13.5px; background: transparent; font-family: inherit; }
.plan-table textarea.plan-textcell { resize: none; overflow: hidden; line-height: 1.45; white-space: pre-wrap; display: block; vertical-align: middle; }
.plan-table input:focus, .plan-table select:focus, .plan-table textarea:focus { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--surface); position: relative; z-index: 1; }
.plan-table .plan-stt { width: 46px; text-align: center; color: var(--text-soft); font-size: 12.5px; font-weight: 600; background: var(--gray-bg); padding: 6px; position: sticky; left: 0; z-index: 1; }
.plan-table thead .plan-stt { z-index: 3; }
.plan-table .plan-rowact { width: 44px; padding: 4px 6px; text-align: center; }
.plan-status { cursor: pointer; font-weight: 600; }
.plan-status.stat-green { background: var(--green-bg); color: var(--green); }
.plan-status.stat-amber { background: var(--amber-bg); color: var(--amber); }
.plan-status.stat-red { background: var(--red-bg); color: var(--red); }
.plan-status.stat-blue { background: var(--blue-bg); color: var(--blue); }
.plan-status.stat-gray { background: var(--gray-bg); color: var(--text-soft); }
.plan-save-ind { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.plan-save-ind.saving { color: var(--amber); }
.plan-save-ind.saved { color: var(--green); }
.plan-linkcell { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.plan-linkcell input { min-width: 0; }
.plan-linkcell a { flex-shrink: 0; color: var(--primary); }
.plan-th-name { display: block; padding: 7px 22px 7px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-col-resize { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; }
.plan-col-resize:hover { background: var(--primary); opacity: .4; }
.plan-fill-grid { display: grid; grid-template-columns: repeat(5, 26px); gap: 6px; }
.plan-fill-sw { width: 26px; height: 26px; border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1; color: var(--text-soft); padding: 0; }
.plan-fill-sw:hover { transform: scale(1.08); }
.plan-col-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.plan-col-row select { width: auto; min-width: 0; }
.plan-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }

/* ---------- Lịch họp ---------- */
.mt-grid { display: grid; grid-template-columns: 2fr 1fr 1.5fr; gap: 12px; }
.mt-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--gray-bg); }
.mt-part { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.mt-checkall { grid-column: 1 / -1; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.mt-list { display: flex; flex-direction: column; gap: 10px; }
.mt-item { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.mt-when { flex-shrink: 0; width: 58px; text-align: center; background: var(--blue-bg); border-radius: 10px; padding: 8px 4px; }
.mt-day { font-size: 13px; font-weight: 700; color: var(--blue); }
.mt-time { font-size: 17px; font-weight: 800; color: var(--text); }
.mt-body { flex: 1; min-width: 0; }
.mt-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt-meta { color: var(--text-soft); font-size: 13px; margin-top: 3px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mt-desc { font-size: 13.5px; margin-top: 6px; color: var(--text); }
.mt-parts-list { font-size: 12.5px; color: var(--text-soft); margin-top: 6px; }
.mt-del { flex-shrink: 0; }
@media (max-width: 700px) { .mt-grid { grid-template-columns: 1fr; } .mt-parts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .mt-parts { grid-template-columns: 1fr; } }

/* ============================================================
   RESPONSIVE — tablet & mobile (bổ sung)
   ============================================================ */
@media (max-width: 600px) {
  /* Popover thành panel cố định full-width, luôn nhìn thấy, không bị che */
  .rpt-pop-panel { position: fixed !important; left: 12px !important; right: 12px !important; top: 64px !important; width: auto !important; max-width: none !important; max-height: 78vh; overflow: auto; z-index: 70; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { width: 100%; }
  .plan-switch { display: flex; width: 100%; }
  .plan-switch-btn { flex: 1; justify-content: center; }
  .plan-table input, .plan-table select, .plan-table textarea { min-width: 0; }
  .sched-nav { width: 100%; }
  .sched-nav .btn { flex: 1; justify-content: center; }
  .rpt-folders, .plan-cards, .boards-grid { grid-template-columns: 1fr; }
  .rpt-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .kpi-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .smodal { max-width: 100%; }
  .topbar-title { font-size: 15px; }
}
