/* =====================================================================
   CHUNG ĐẠT MARKETING — Giao diện mobile-first
   Màu thương hiệu: đỏ đậm #D90429 + đen + trắng (theo logo Chung Đạt Store)
   Font: Be Vietnam Pro (tự chứa trong app, subset tiếng Việt đầy đủ dấu)
   Đợt chỉnh sửa 2 (24/10/2026): PHẲNG — SÁNG — SẠCH.
   Nền xám rất nhạt, thẻ trắng viền 1px mảnh, bo góc vừa, KHÔNG gradient
   màu mè, không hiệu ứng bóng bẩy. Trang chủ là sảnh chọn mục: lưới nút
   icon + chữ, mỗi mục một trang riêng. Đỏ thương hiệu dùng tiết kiệm:
   nút hành động chính, cảnh báo, mục đang chọn.
   ===================================================================== */
:root {
  --red: #D90429;
  --red-dark: #A90320;
  --green: #16a34a;
  --green-bg: #e9f7ef;
  --green-soft: #8fae99;
  --ink: #141414;
  --text: #1d1d1f;
  --muted: #6b7280;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

img { max-width: 100%; }
a { color: var(--red-dark); }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- Thanh trên cùng ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink); color: #fff;
  border-bottom: 3px solid var(--red);
}
.topbar-inner {
  max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16.5px; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: #fff; flex: 0 0 auto; }
.user-chip {
  margin-left: auto; flex: 0 1 auto; min-width: 0;
  font-size: 12.5px; background: #262626; color: #f3f4f6;
  padding: 7px 11px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Dải slogan (giữ trên mọi màn hình chính, để gọn và dịu) ---------- */
.slogan-strip {
  background: #22161a; color: #d8ccd0;
  text-align: center; padding: 6px 14px;
}
.slogan-text { font-style: italic; font-size: 11.5px; line-height: 1.45; max-width: 680px; margin: 0 auto; }
.slogan-by { font-size: 10.5px; color: #a48b91; margin-top: 1px; font-weight: 600; letter-spacing: .02em; }

/* ---------- Khung nội dung ---------- */
.container { max-width: 680px; margin: 0 auto; padding: 16px 14px 116px; }

h2 { font-size: 20px; margin: 8px 0 10px; }
.greeting { font-size: 21px; font-weight: 800; margin: 6px 0 0; }
.today-label { margin: 2px 0 16px; color: var(--muted); font-size: 13.5px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { font-size: 17.5px; font-weight: 800; margin: 24px 0 12px; }
.section-title.section-main { font-size: 19px; margin: 22px 0 12px; }
.section-title.danger { color: #b91c1c; }
.card-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; }

/* ---------- Thẻ (card) chung: trắng, viền 1px mảnh, không bóng đổ ---------- */
.form-card, .detail-card, .action-card, .idea-card, .tpl-card,
.notify-card, .install-card, .announce-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}

/* Thẻ thông báo (bật thông báo) — viền hồng nhạt + gân đỏ bên trái */
.notify-card { border: 1px solid #f0c6cd; border-left: 4px solid var(--red); background: #fff; }
.push-note { font-size: 13px; color: var(--muted); }
.push-denied-hint {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.5;
}

/* Thẻ gợi ý cài app */
.install-card { border: 1px dashed #d5d9de; background: #fff; }

/* Bảng tin của Trợ lý Vũ Tài — phẳng: thẻ trắng, gân đỏ trái, chữ sẫm */
.announce-card { border-left: 4px solid var(--red); padding: 14px 16px; }
.announce-title { font-weight: 800; font-size: 15.5px; margin-bottom: 4px; color: var(--text); }
.announce-body { font-size: 14px; line-height: 1.55; color: #333; }
.announce-time { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ---------- SẢNH CHỌN MỤC: lưới icon NHỎ, tất cả XANH LÁ, 4 cột (đợt v5) ----------
   Kiểu app quản lý (ChViet): mỗi ô chỉ gồm 1 ô icon vuông bo góc nền xanh lá
   rất nhạt + icon nét xanh lá + nhãn chữ nhỏ nằm dưới. Không thẻ to, không
   mỗi mục một màu. Toàn bộ sảnh ép gọn trong 1 màn hình điện thoại. */
.menu-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px; margin: 8px 0 4px;
}
.menu-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 2px 0; background: transparent; border: none;
  text-decoration: none; color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:active .menu-icon { background: #d7f0df; }
.menu-icon {
  position: relative;
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.menu-icon svg { width: 23px; height: 23px; }
.menu-label { font-size: 12px; font-weight: 600; line-height: 1.25; text-align: center; }
.menu-badge {
  position: absolute; top: -5px; right: -7px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--green); color: #fff;
  border: 2px solid var(--bg);
  font-size: 10.5px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-badge.danger { background: #dc2626; }

/* Hàng chào 1 dòng trên sảnh: tên bên trái, ngày bên phải */
.home-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0 0 10px;
}
.home-hello { font-size: 16.5px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* Banner nhắc bật thông báo trên sảnh — 1 dòng mảnh, chữ dài thì cắt … */
.push-banner {
  display: flex; align-items: center; gap: 8px;
  background: #fff5f5; border: 1px solid #f3d2d2; border-radius: 10px;
  padding: 9px 12px; margin-bottom: 12px;
  color: #8f1d1d; text-decoration: none;
  font-weight: 600; font-size: 13px; line-height: 1.35;
}
.push-banner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.push-banner-icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--red); }

/* ---------- TRANG HOME: ép gọn để vừa 1 màn hình, không cần cuộn ----------
   Chỉ áp dụng khi body có class .page-home (header.php gắn cho trang chủ);
   các trang khác giữ nguyên khoảng cách như cũ. */
body.page-home .container { padding-top: 10px; }
body.page-home .slogan-strip { padding: 3px 12px; }
body.page-home .slogan-text { font-size: 10.5px; line-height: 1.35; }
body.page-home .slogan-by { font-size: 9.5px; margin-top: 0; }
body.page-home .announce-card { padding: 10px 12px; margin-bottom: 10px; }
body.page-home .announce-title {
  font-size: 14px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.page-home .announce-body {
  font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.page-home .announce-time { font-size: 11px; margin-top: 4px; }

/* ---------- Lưới con số tổng quan (giữ tương thích các trang cũ) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 8px; }
.stat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-cell {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 8px 12px; text-align: center;
}
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-num.red { color: #dc2626; }
.stat-num.amber { color: #d97706; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Dải cảnh báo quá hạn */
.overdue-strip {
  display: flex; align-items: center; gap: 8px;
  background: #fff5f5; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 12px; padding: 10px 14px;
  font-weight: 700; font-size: 14.5px; margin: 18px 0 12px;
}

/* ---------- Nút bấm (vùng chạm >= 48px) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 15.5px;
  cursor: pointer; text-decoration: none; text-align: center;
  background: #fff; color: var(--text);
}
.btn:active { transform: scale(.99); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-dark); }
.btn-success { background: #15803d; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-light { background: #fff; border-color: #e0e2e6; color: var(--text); }
.btn-danger-outline { background: #fff; border-color: var(--red); color: var(--red); }
.btn-big { width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .65; cursor: default; }
.form-card .btn, .action-card .btn { width: 100%; margin-top: 10px; }
.tpl-card .btn-copy { margin-top: 2px; }

/* ---------- Form ---------- */
label { display: block; font-weight: 600; font-size: 14.5px; margin: 14px 0 6px; }
form > label:first-child { margin-top: 0; }
input[type="text"], input[type="url"], input[type="datetime-local"],
select, textarea {
  width: 100%; min-height: 48px;
  padding: 11px 12px;
  border: 1.5px solid #d8dce1; border-radius: 12px;
  font: inherit; font-size: 16px; /* 16px để iPhone không tự phóng to khi nhập */
  background: #fff; color: var(--text);
}
input[type="file"] {
  width: 100%; min-height: 48px;
  padding: 10px 12px;
  border: 1.5px dashed #d5d9de; border-radius: 12px;
  font: inherit; font-size: 15px;
  background: #fff; color: var(--text);
}
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--red); outline: none;
  box-shadow: 0 0 0 3px rgba(217, 4, 41, .14);
}
details.form-card summary {
  font-weight: 700; cursor: pointer; min-height: 44px;
  display: flex; align-items: center;
}

/* ---------- Cảnh báo / trống ---------- */
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14.5px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.empty-box {
  background: #fff; border: 1px dashed #d8dce1; color: var(--muted);
  border-radius: 14px; padding: 18px; text-align: center; margin-bottom: 12px; font-size: 14.5px;
}

/* ---------- Việc (task) ---------- */
.task-card {
  display: block; background: #fff; color: inherit; text-decoration: none;
  border-radius: 14px; padding: 16px 18px; margin-bottom: 12px;
  border: 1px solid var(--line); border-left: 3px solid #e4e4e7;
}
.task-card.overdue { border-color: #f3d2d2; border-left-color: var(--red); background: #fffafa; }
.task-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 7px; }
.task-title { font-weight: 700; font-size: 16.5px; line-height: 1.4; overflow-wrap: anywhere; }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px }

/* Nhãn (pill) */
.pill {
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  background: #f4f4f5; color: #52525b;
}
.pill-todo   { background: #ececec; color: #555; }
.pill-doing  { background: #dbeafe; color: #1d4ed8; }
.pill-review { background: #fef3c7; color: #b45309; }
.pill-done   { background: #dcfce7; color: #15803d; }
.pill-danger { background: #fee2e2; color: #b91c1c; }
.pill-creator { background: #f4f4f5; color: #3f3f46; }
.pill-cat    { background: #eef1f4; color: #475569; }
.pill-channel { background: #f4f4f5; color: #52525b; border: 1px solid #e4e4e7; }
.pill-photo  { background: #eef1f4; color: #475569; }

/* Ô chọn kênh */
.channel-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.channel-check {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; margin: 0; padding: 8px 14px;
  background: #fff; border: 1.5px solid #d8dce1; border-radius: 999px;
  font-size: 14.5px; cursor: pointer;
}
.channel-check input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--red); margin: 0; }

/* Chi tiết việc */
.detail-title { font-size: 20px; margin: 4px 0 8px; overflow-wrap: anywhere; }
.detail-desc { font-size: 15px; margin-bottom: 10px; overflow-wrap: anywhere; }
.detail-meta div { margin: 6px 0; font-size: 14.5px; }
.evidence-photo { margin-top: 10px; }
.evidence-photo img {
  max-width: 100%; display: block; margin-top: 6px;
  border-radius: 12px; border: 1px solid var(--line);
}
.done-banner {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
  border-radius: 14px; padding: 14px; text-align: center; font-weight: 700; margin-bottom: 16px;
}

/* Bình luận */
.comment-item { background: #fff; border: 1px solid #eceef1; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.comment-head { font-size: 13.5px; margin-bottom: 3px; }
.comment-body { font-size: 14.5px; overflow-wrap: anywhere; }

/* Nhật ký hoạt động */
.activity-list {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2px 16px; margin-bottom: 16px;
}
.activity-item {
  padding: 10px 0; font-size: 13.5px; line-height: 1.5;
  border-bottom: 1px solid #f1f2f4;
}
.activity-item:last-child { border-bottom: none; }

/* Ý tưởng & mẫu */
.idea-desc { font-size: 14.5px; color: #333; margin: 6px 0 12px; overflow-wrap: anywhere; }
.tpl-content {
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: #fafbfc; border: 1px solid #e8eaed; border-radius: 12px;
  padding: 12px; font-size: 14.5px; line-height: 1.55; margin: 10px 0;
}

/* Chips số liệu + bộ lọc */
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 13.5px; }
.chip-red { border-color: #fecaca; background: #fff5f5; color: #b91c1c; }
.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.fchip {
  flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1px solid #e0e2e6; color: var(--text);
  text-decoration: none; font-size: 14px; font-weight: 600;
}
.fchip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.fchip-danger { color: #b91c1c; }
.fchip-danger.active { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.filter-form { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.filter-form label { margin: 0; white-space: nowrap; }
.filter-form select { flex: 1 1 120px; min-width: 0; width: auto; }

/* ---------- Dải link shop + thanh tab dưới ---------- */
.shop-links { text-align: center; margin: 4px 0 108px; }
.shop-links a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 700; text-decoration: none; color: var(--red-dark);
  background: #fff; border: 1px solid #ecd9dc; border-radius: 999px; padding: 8px 18px;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 1px solid #e8e8ea;
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; min-height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--green-soft); text-decoration: none; padding: 7px 2px;
}
.tab svg { width: 22px; height: 22px; }
.tab span { font-size: 11px; font-weight: 600; }
.tab.active { color: var(--green); }

/* ---------- Đăng nhập (nền phẳng, giữ khối slogan trang trọng) ---------- */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: #20060b;
}
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 22px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.35); text-align: center; }
.login-logo-img { width: 148px; height: 148px; object-fit: cover; border-radius: 24px; display: block; margin: 0 auto 10px; box-shadow: 0 4px 16px rgba(120, 0, 20, .25); }
.login-card h1 { font-size: 22px; margin: 4px 0 2px; font-weight: 800; }
.login-sub { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.login-card form { text-align: left; margin-top: 12px; }
.login-note { font-size: 13px; color: var(--muted); margin-top: 14px; }
.slogan-quote {
  margin: 14px 0 2px; padding: 12px 14px; text-align: left;
  border-left: 4px solid var(--red); background: #fff7f7;
  border-radius: 0 12px 12px 0;
}
.slogan-quote p { font-style: italic; margin: 0; font-size: 14.5px; line-height: 1.55; color: #3f1d22; }
.slogan-quote cite { display: block; margin-top: 6px; font-size: 12.5px; font-style: normal; font-weight: 700; color: var(--red-dark); }

/* ---------- Cá nhân ---------- */
.profile-name { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.link-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; padding: 12px 16px; border-radius: 12px; margin-bottom: 8px;
  border: 1px solid #eceef1;
  color: var(--text); text-decoration: none; font-weight: 600; min-height: 48px;
}

@media (min-width: 600px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .login-logo-img { width: 168px; height: 168px; }
}
