/* Dũng Mori CRM — giao diện chung. Màu chủ đạo xanh Dũng Mori; icon nét tròn (crm/icons.py), không dùng emoji. */
:root {
  --mori: #56d060;
  --brand: #2f7d4a;            /* xanh đậm như nút icon trên web Dũng Mori */
  --brand-dark: #24633a;
  --brand-soft: #e9f5ec;
  --brand-ring: #bfe3c8;
  --rail: #27873a; --rail-active: #1d6b2d; --rail-hover: #2f9443; --rail-text: #e2f7e5;
  --green: #2e9e3a; --green-soft: #eaf7ec;
  --red: #d64545; --red-soft: #fdeeee; --orange: #d9822b; --orange-soft: #fff3e3; --blue: #2f6fd6; --blue-soft: #ebf2fd;
  --text: #1f2328; --text-2: #4a5059; --muted: #7d848e; --line: #e7e9ec; --line-2: #d8dce1;
  --bg: #fff; --bg-soft: #f6f7f8; --bg-soft-2: #f0f2f4;
  --r: 10px; --r-sm: 8px; --h: 38px; --h-sm: 32px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --shadow-pop: 0 12px 32px rgba(16,24,40,.14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Be Vietnam Pro", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
       color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15.5px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
small, .small { font-size: 12.5px; }
code { background: var(--bg-soft-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- icon ---------- */
.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
/* icon trong vòng tròn xanh đậm — giống bộ nút Test / Cửa hàng / Tư vấn của Dũng Mori */
.bubble { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; flex: 0 0 auto;
          display: inline-flex; align-items: center; justify-content: center; }
.bubble .ic { width: 22px; height: 22px; stroke-width: 1.9; }
.bubble.sm { width: 34px; height: 34px; } .bubble.sm .ic { width: 18px; height: 18px; }
.bubble.soft { background: var(--brand-soft); color: var(--brand); }

/* ---------- thanh điều hướng trái ---------- */
.rail { position: fixed; inset: 0 auto 0 0; width: 88px; background: var(--rail);
        display: flex; flex-direction: column; z-index: 10; }
/* logo CRM: chữ C trắng trên ô cam chuyển sắc (như nhãn VIP) -> khác hẳn HRM màu xanh */
.rail .logo { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 0 10px; }
.rail .logo:hover { text-decoration: none; }
.rail .logo img { width: 50px; height: 50px; display: block; border-radius: 15px;
                  box-shadow: 0 4px 12px rgba(226, 73, 47, .45), 0 0 0 2px rgba(255, 255, 255, .18); transition: transform .15s; }
.rail .logo:hover img { transform: translateY(-1px) scale(1.03); }
.rail .logo span { color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .14em; padding-left: .14em; opacity: .9; }
.rail a.nav { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 13px 4px;
              color: var(--rail-text); font-size: 11.5px; position: relative; text-align: center; }
.rail a.nav:hover { color: #fff; text-decoration: none; background: var(--rail-hover); }
.rail a.nav.active { background: var(--rail-active); color: #fff; font-weight: 600; }
.rail a.nav .ic { width: 22px; height: 22px; }
.rail .badge { position: absolute; top: 7px; left: calc(50% + 6px); background: #e5484d; color: #fff;
               font-size: 10.5px; line-height: 16px; min-width: 16px; border-radius: 8px; padding: 0 4px; font-weight: 600; }
.rail .spacer { flex: 1; }
/* khối tài khoản ở đáy thanh bên: chữ cái đầu + tên (bấm mở Tài khoản của tôi), kẻ ngăn với menu */
.rail-out { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 0 8px; padding: 10px 0 12px;
            border-top: 1px solid rgba(255, 255, 255, .16); }
.rail-out form { margin: 0; display: flex; justify-content: center; }
.rail-out .me { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; border-radius: 10px;
                color: #fff; font-size: 11.5px; font-weight: 600; text-align: center; }
.rail-out .me:hover { background: var(--rail-hover); text-decoration: none; }
.rail-out .me-av { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--rail);
                   display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.rail-out .me-n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-out button { background: none; border: 0; color: var(--rail-text); cursor: pointer; display: flex; padding: 6px 4px; border-radius: 10px; width: 100%; justify-content: center;
                   flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: 11.5px; }
.rail-out button:hover { color: #fff; background: var(--rail-hover); }

.main { margin-left: 88px; min-height: 100vh; }
.page { padding: 0 32px 48px; max-width: 1440px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 22px 0 18px; }
.topbar .grow, .grow { flex: 1; }
.topbar h1 small { font-size: 15px; font-weight: 400; color: var(--muted); }

/* ---------- nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--h);
       padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--brand); color: #fff;
       font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn .ic { width: 18px; height: 18px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.soft:hover { background: #dcefe1; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #bf3535; }
.btn.danger-ghost { background: #fff; color: var(--red); border-color: #f2c9c9; }
.btn.danger-ghost:hover { background: var(--red-soft); }
.btn.sm { height: var(--h-sm); padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: var(--h-sm); height: var(--h-sm); border-radius: var(--r-sm); border: 0; background: none; color: var(--text-2);
            display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex: 0 0 auto; }
.icon-btn:hover { background: var(--bg-soft-2); color: var(--text); }
.icon-btn.on { background: var(--brand-soft); color: var(--brand); }
.icon-btn .ic { width: 19px; height: 19px; }

/* ---------- ô nhập ---------- */
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line-2);
                          border-radius: var(--r-sm); padding: 0 11px; max-width: 100%; }
input, select { height: var(--h); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; }
input[type=color] { width: 40px; padding: 3px; }
input[type=file] { height: auto; padding: 6px; }
textarea { padding: 9px 11px; width: 100%; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-ring); outline-offset: 0; border-color: var(--brand); }
select { appearance: none; padding-right: 32px; cursor: pointer;
         background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d848e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E") no-repeat right 9px center / 16px; }
select[multiple] { background-image: none; padding: 4px; height: auto; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.input-icon input { padding-left: 36px; width: 100%; }
label.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* công tắc bật/tắt */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .tr { width: 38px; height: 22px; border-radius: 11px; background: #cfd4da; position: relative; transition: background .15s; flex: 0 0 38px; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
                     background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { left: 19px; }
.switch input:focus-visible + .tr { outline: 3px solid var(--brand-ring); }

.msg { padding: 11px 14px; border-radius: var(--r-sm); margin: 14px 0 0; background: var(--green-soft); color: #1c5a2b; }
.msg.error { background: var(--red-soft); color: #9c2b2b; }
.msg.info { background: var(--blue-soft); color: #1f4f9a; }

/* ---------- nhãn ---------- */
/* nhãn theo màu riêng (giai đoạn, thẻ): đặt style="--c:#màu" — nền nhạt, chữ đậm cùng màu */
.stage { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px;
         font-weight: 500; white-space: nowrap; color: color-mix(in srgb, var(--c, #7d848e) 78%, #000);
         background: color-mix(in srgb, var(--c, #7d848e) 13%, #fff); }
.stage::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #7d848e); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
       white-space: nowrap; color: color-mix(in srgb, var(--c, #2e9e3a) 80%, #000); background: color-mix(in srgb, var(--c, #2e9e3a) 14%, #fff); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
        background: var(--bg-soft-2); color: var(--text-2); white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c8ccd2; display: inline-block; flex: 0 0 8px; }
.dot.on { background: #2fbf4f; }

/* ---------- thẻ số liệu, khung ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: block; color: inherit; background: #fff; }
a.kpi:hover { border-color: var(--brand-ring); text-decoration: none; }
.kpi b { display: block; font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.warn b { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; background: #fff; }
.card h2 small { font-weight: 400; color: var(--muted); }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty img { width: 96px; display: block; margin: 0 auto 8px; }

.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .track { background: var(--bg-soft-2); border-radius: 4px; height: 16px; overflow: hidden; }
.bar .fill { background: var(--green); height: 100%; border-radius: 4px; }
.bar .num { text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; background: var(--bg-soft-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg a, .seg button { padding: 0 12px; height: 30px; display: inline-flex; align-items: center; border-radius: 6px; color: var(--text-2);
                      font: inherit; font-size: 13px; border: 0; background: none; cursor: pointer; white-space: nowrap; }
.seg a.on, .seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; color: var(--text); }

/* ---------- bảng ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px 12px;
          border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfb; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fafcfb; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; overflow-x: auto; }
.tbl-wrap .tbl tr:last-child td { border-bottom: 0; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-cell b { font-weight: 500; color: var(--text); display: block; }
.who-cell small { color: var(--muted); }
.av { width: 34px; height: 34px; border-radius: 50%; background: #dfeee3; color: #2b6a3d; font-size: 12.5px; font-weight: 600;
      display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* thanh công cụ danh sách: tìm + vài bộ lọc chính + nút "Bộ lọc" */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input-icon { flex: 1 1 280px; max-width: 420px; }
.toolbar select { min-width: 150px; }
.more-filters { display: none; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; padding: 14px; background: var(--bg-soft);
                border-radius: var(--r); margin-bottom: 12px; }
.more-filters.open { display: flex; }
.more-filters .field { display: flex; flex-direction: column; gap: 4px; }
.more-filters .field label { font-size: 12.5px; color: var(--muted); margin: 0; }
.count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand);
         color: #fff; font-size: 11px; align-items: center; justify-content: center; font-weight: 600; }
.bulk { position: sticky; top: 0; z-index: 3; display: none; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 8px;
        background: #1f2a24; color: #fff; border-radius: var(--r); }
.bulk.show { display: flex; }
.bulk select { height: var(--h-sm); }
.pager { display: flex; gap: 8px; justify-content: center; margin: 18px 0; align-items: center; }

/* ---------- chi tiết khách ---------- */
.detail { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.info dl { display: grid; grid-template-columns: 112px 1fr; gap: 9px 10px; margin: 0; font-size: 13.5px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; word-break: break-word; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.stepper button { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 0 14px; height: 32px;
                  font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.stepper button:hover { border-color: var(--brand); color: var(--text); }
.stepper button.on { color: #fff; border-color: transparent; font-weight: 600; }
.lost-box { display: none; gap: 8px; align-items: center; margin: -6px 0 16px; flex-wrap: wrap; }
.lost-box.show { display: flex; }
.act-form { display: grid; gap: 10px; }
.act-form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.act-form .row input { flex: 1; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-soft-2); color: var(--text-2);
                   display: flex; align-items: center; justify-content: center; }
.timeline .tl-ic .ic { width: 16px; height: 16px; }
.timeline .tl-ic.contact { background: var(--brand-soft); color: var(--brand); }
.timeline .meta { font-size: 12.5px; color: var(--muted); }
.timeline .body { white-space: pre-wrap; margin-top: 2px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list li.done .t { text-decoration: line-through; color: var(--muted); }
.task-list form { margin: 0; }
.check { width: 20px; height: 20px; border: 1.5px solid #bfc5cc; border-radius: 50%; background: #fff; cursor: pointer;
         padding: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.check .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.check:hover { border-color: var(--brand); }
.done .check { background: var(--brand); border-color: var(--brand); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.inline-form input:not([type=checkbox]):not([type=color]):not([type=file]) { flex: 1; min-width: 140px; }

/* ---------- form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; max-width: 860px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.field .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.errorlist { color: var(--red); margin: 8px 0; padding-left: 18px; }

/* ---------- pipeline kéo thả ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.col { flex: 0 0 264px; background: var(--bg-soft); border-radius: var(--r); display: flex; flex-direction: column;
       max-height: calc(100vh - 140px); }
.col-h { padding: 12px; font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.col-h::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col-h .n { color: var(--muted); font-weight: 400; margin-left: auto; }
.col-b { padding: 0 8px 10px; overflow-y: auto; min-height: 80px; flex: 1; }
.col.over { outline: 2px dashed var(--brand); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 11px; margin-bottom: 8px;
         cursor: grab; display: block; color: inherit; font-size: 13px; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--brand-ring); text-decoration: none; }
.kcard b { display: block; font-weight: 500; font-size: 13.5px; margin-bottom: 3px; }
.kcard .m { color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kcard.dragging { opacity: .4; }
.tgroup h2 { margin-top: 20px; }
.tgroup.late h2 { color: var(--red); }

/* ---------- đăng nhập ---------- */
body.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.login-art { background: linear-gradient(160deg, #e5f6e8, #c9ecd0); display: flex; flex-direction: column; align-items: center;
             justify-content: center; padding: 40px; text-align: center; color: #1f5c34; }
.login-art img { width: min(320px, 70%); }
.login-art h2 { font-size: 22px; margin: 16px 0 6px; }
.login-art p { margin: 0; color: #3d6b4b; max-width: 360px; }
/* khung đăng nhập theo Pancake: tiêu đề lớn, ô nhập cao bo tròn, nút tròn dài, "Hoặc tiếp tục với" + Facebook */
.login-box { margin: auto; width: min(400px, 90vw); display: flex; flex-direction: column; gap: 14px; }
.login .brand { display: flex; align-items: center; gap: 10px; }
.login .brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 4px 12px rgba(226, 73, 47, .35); }
.login .brand span { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.login h1 { font-size: 32px; letter-spacing: -.03em; margin: 18px 0 4px; }
.login .msg { margin: 0; }
.login form { display: grid; gap: 12px; }
.login input:not([type=hidden]) { height: 50px; border-radius: 12px; padding: 0 16px; font-size: 15px; }
.login .btn { height: 50px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.login-help { margin: 0; font-size: 13px; color: var(--muted); }
.login-or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* nút Facebook (đăng nhập, liên kết) */
.btn.fb-btn { background: #1877f2; color: #fff; }
.btn.fb-btn:hover { background: #0f63d0; }
.btn.fb-btn:disabled { opacity: .45; cursor: not-allowed; }
.fb-f { width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #1877f2; display: inline-flex; align-items: flex-end;
        justify-content: center; font: 700 17px/1 Helvetica, Arial, sans-serif; overflow: hidden; flex: none; }
.fb-f::before { content: "f"; margin-bottom: -2px; margin-left: 2px; }
.fb-linked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.fb-linked small { display: block; }

/* ---------- cài đặt ---------- */
.st { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; padding-top: 22px; }
.st-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; align-self: start; }
.st-nav h1 { margin: 0 0 14px 10px; }
.st-nav a { display: flex; align-items: center; gap: 11px; padding: 0 12px; height: 40px; border-radius: var(--r-sm); color: var(--text-2); }
.st-nav a .ic { color: var(--muted); width: 19px; height: 19px; }
.st-nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--text); }
.st-nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.st-nav a.on .ic { color: var(--brand); }
.st-nav .sep { height: 1px; background: var(--line); margin: 8px 10px; }
.st-h { font-size: 20px; margin: 0 0 4px; }
.st-sub { color: var(--muted); margin: 0 0 18px; }
.st-section { margin-top: 28px; }
.st-section > h2 { display: flex; align-items: center; gap: 8px; }

/* kết nối kênh */
.connect { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 8px; }
.cn-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.cn-card .cn-top { display: flex; align-items: center; gap: 12px; }
.cn-card b { font-size: 15px; display: block; }
.cn-card p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.cn-card .note { font-size: 12px; color: var(--orange); }
.pf-logo { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
           color: #fff; font-weight: 700; font-size: 20px; flex: 0 0 auto; }
.pf-logo.sm { width: 36px; height: 36px; border-radius: 10px; }
.pf-logo.facebook { background: #1877f2; } .pf-logo.facebook::before { content: "f"; font-size: 26px; font-family: Helvetica, Arial, sans-serif; }
.pf-logo.zalo { background: #0068ff; } .pf-logo.zalo::before { content: "Zalo"; font-size: 12px; }
.pf-logo.zalo_ca_nhan { background: #fff; color: #0068ff; box-shadow: inset 0 0 0 2px #0068ff; } .pf-logo.zalo_ca_nhan::before { content: "Zalo"; font-size: 12px; }
.pf-logo.tiktok { background: #111; } .pf-logo.tiktok::before { content: "♪"; font-size: 22px; }
.ch-list { border: 1px solid var(--line); border-radius: var(--r); }
.ch-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; }
.ch-row + .ch-row, .ch-edit + .ch-row { border-top: 1px solid var(--line); }
.ch-row .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-row .acts { display: flex; gap: 4px; align-items: center; }
.ch-edit { display: none; padding: 0 16px 16px 64px; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.ch-edit.open { display: flex; }
.ch-edit .field { min-width: 200px; }
.ch-err { color: var(--red); font-size: 12.5px; margin-top: 2px; }
details.guide { border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; margin-top: 12px; }
details.guide summary { cursor: pointer; padding: 13px 0; font-weight: 500; color: var(--text-2); }
details.guide[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }

/* xoay vòng */
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.modes button { text-align: left; padding: 14px; border-radius: var(--r); border: 1.5px solid var(--line); background: #fff;
                font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.modes button:hover { border-color: var(--brand-ring); }
.modes button b { font-weight: 600; font-size: 13.5px; }
.modes button small { color: var(--muted); }
.modes button.on { border-color: var(--brand); background: var(--brand-soft); }
.modes button.on .bubble { background: var(--brand); color: #fff; }
.sw { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.sw input { margin-top: 2px; }
.cfg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); align-items: center; }
.cfg:first-of-type { border-top: 0; }
.cfg small { display: block; color: var(--muted); margin-top: 3px; font-size: 13px; }
.cfg .row, .grp .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.day-chk { font-size: 12.5px; display: inline-flex; gap: 3px; align-items: center; }
.rr-tbl .pick { display: inline-flex; align-items: center; gap: 4px; }
.rr-tbl .ord { min-width: 18px; font-size: 11px; color: var(--brand); font-weight: 600; }
.rr-tbl .ratio { width: 64px; height: var(--h-sm); }
.st-seg button { height: 28px; padding: 0 10px; font-size: 12.5px; }
.grp { padding: 12px 0; border-top: 1px solid var(--line); }
.grp .members { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13.5px; }
.perm-wrap { overflow-x: auto; }
.perm th.c, .perm td.c { text-align: center; font-size: 12.5px; }
.perm .role-h td { background: var(--bg-soft); font-weight: 600; }
.perm tr.off td { opacity: .55; }
.perm .ch-sel { min-width: 150px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; min-height: 140px; justify-content: center; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }
.qr-box .av-big { width: 64px; height: 64px; border-radius: 50%; }

/* biểu tượng nền tảng nhỏ (gắn cạnh tên trang) */
.pf { width: 16px; height: 16px; border-radius: 50%; font-style: normal; font-size: 9px; font-weight: 700; color: #fff;
      display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex: 0 0 auto; }
.pf-facebook { background: #1877f2; } .pf-facebook::before { content: "f"; font-size: 11px; }
.pf-zalo { background: #0068ff; } .pf-zalo::before { content: "Z"; }
.pf-zalo_ca_nhan { background: #fff; color: #0068ff; box-shadow: inset 0 0 0 1.5px #0068ff; } .pf-zalo_ca_nhan::before { content: "Z"; }
.pf-tiktok { background: #111; } .pf-tiktok::before { content: "♪"; }

/* ---------- thống kê ---------- */
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 8px; }
.mchart { margin: 0; }
.mchart figcaption { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.mchart figcaption b { font-size: 22px; color: var(--text); font-weight: 600; }
.plot { position: relative; height: 140px; border-bottom: 1px solid #e3e6e9; }
.plot .ymax { position: absolute; top: -2px; left: 0; font-size: 11px; color: var(--muted); }
.plot::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 1px solid #f0f1f3; }
.cols { position: absolute; inset: 16px 0 0; display: flex; align-items: flex-end; gap: 2px; }
.col-hit { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.col-hit i { display: block; width: 100%; max-width: 24px; background: var(--green); border-radius: 4px 4px 0 0; }
.col-hit:hover i { background: #237a33; }
.xax { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.tip { position: fixed; z-index: 30; background: #223; color: #fff; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.medal { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; align-items: center;
         justify-content: center; margin-right: 6px; color: #fff; background: #b08d2c; }
.medal.m2 { background: #8a9099; } .medal.m3 { background: #a0673a; }
.rating-avg { font-size: 30px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.rating-avg .ic { color: #eda100; fill: #eda100; width: 26px; height: 26px; }

/* ---------- điện thoại ---------- */
@media (max-width: 900px) {
  .rail { inset: auto 0 0 0; width: auto; height: 62px; flex-direction: row; }
  .rail .logo, .rail .spacer, .rail-out .me, .rail a.nav.x { display: none; }
  .rail a.nav { flex: 1; padding: 8px 2px; font-size: 10.5px; gap: 3px; }
  .rail-out { padding: 8px 6px; margin: 0; border-top: 0; justify-content: center; }
  .rail-out button { font-size: 10.5px; }
  .main { margin: 0 0 62px; }
  .page { padding: 0 16px 32px; }
  .grid2, .detail, .form-grid, .st { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 110px 1fr 56px; }
  .tbl .hide-m { display: none; }
  .toolbar .input-icon { max-width: none; }
  .col { flex-basis: 78vw; }
  .st-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .st-nav h1 { width: 100%; }
  .modes, .multiples { grid-template-columns: 1fr 1fr; }
  .cfg { grid-template-columns: 1fr; }
  .ch-row { grid-template-columns: 1fr; }
  .ch-edit { padding-left: 16px; }
  body.login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
.tag .x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; display: inline-flex; opacity: .7; }
.tag .x:hover { opacity: 1; }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ch-pick { position: relative; }
.ch-pick summary { list-style: none; cursor: pointer; height: var(--h-sm); display: inline-flex; align-items: center; gap: 6px; padding: 0 30px 0 12px;
                   border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 13px; white-space: nowrap;
                   background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d848e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E") no-repeat right 8px center / 15px; }
.ch-pick summary::-webkit-details-marker { display: none; }
.ch-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: var(--r);
          box-shadow: var(--shadow-pop); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.ch-pop label { font-size: 13px; }


/* ---------- Bảng điều khiển trang + chế độ gộp trang (theo Pancake) ---------- */
.dash { display: flex; flex-direction: column; gap: 12px; padding-top: 22px; min-width: 0; }
.dash > * { min-width: 0; }
.dash-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.dash-head h1 { margin: 0 0 12px; font-size: 20px; }
.dash-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-q { flex: 0 1 420px; }
.dash-q input { background: var(--bg-soft); border-color: transparent; height: 40px; border-radius: 10px; }
.dash-q input:focus { background: #fff; }
.dash-bar .icon-btn { width: 40px; height: 40px; }
.dash-tabs { display: flex; gap: 6px; padding: 10px; overflow-x: auto; }
.dash-tabs button { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 0; border-radius: 10px;
  background: none; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.dash-tabs button:hover { background: var(--bg-soft); }
.dash-tabs button.on { background: var(--brand-soft); color: var(--brand); }
.dash-tabs button .ic { width: 18px; height: 18px; }
.dash-tabs i, .gop-tabs i { font-style: normal; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bg-soft-2); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.dash-tabs button.on i, .gop-tabs button.on i { background: var(--brand); color: #fff; }
.dash-tabs .pf { width: 18px; height: 18px; border-radius: 5px; }
.dash-none { margin: 4px 0 0; }
.dash .empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 20px; }

.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.pg-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 40px 12px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; min-width: 0;
  transition: border-color .12s, box-shadow .12s, transform .12s; }
.pg-card:hover { border-color: var(--brand-ring); box-shadow: 0 6px 18px rgba(16, 24, 40, .08); transform: translateY(-1px); text-decoration: none; }
.pg-card[hidden] { display: none; }
.pg-card.off { opacity: .6; }
.pg-av { position: relative; width: 64px; height: 64px; flex: none; border-radius: 12px; overflow: hidden; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; }
.pg-av b { color: var(--brand); font-size: 24px; }
.pg-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-t { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pg-t b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-t small { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; }
.pg-t small .pf { width: 17px; height: 17px; border-radius: 4px; }
.pg-warn { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: #f08c2e; color: #fff;
  display: flex; align-items: center; justify-content: center; }
.pg-warn .ic { width: 16px; height: 16px; stroke-width: 2.4; }

/* hộp thoại dùng chung (thẻ <dialog>) */
.dlg { border: 0; padding: 0; border-radius: 18px; width: min(520px, 94vw); max-height: 88vh; box-shadow: var(--shadow-pop); color: var(--text); }
.dlg::backdrop { background: rgba(20, 30, 40, .45); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-lg { width: min(1040px, 94vw); height: min(720px, 88vh); background: var(--bg-soft); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; }
.dlg-h b { font-size: 18px; }
.dlg-b { padding: 6px 22px 18px; overflow-y: auto; flex: 1; }
.dlg-f { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fff; }
.kn-list { display: flex; flex-direction: column; gap: 8px; }
.kn-it { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
a.kn-it:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.kn-it small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kn-it.off { opacity: .55; }
.kn-go { transform: rotate(-90deg); color: var(--muted); }

.gop-tabs { display: flex; align-items: flex-end; justify-content: space-between; padding: 6px 22px 0; }
.gop-tabs > div { display: flex; gap: 4px; overflow-x: auto; }
.gop-tabs button:not(.icon-btn) { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 20px; border: 0;
  border-radius: 12px 12px 0 0; background: none; font: inherit; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.gop-tabs button.on { background: #fff; color: var(--text); font-weight: 600; }
.dlg-lg .dlg-b { background: #fff; padding-top: 16px; }
.gop-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pg-card.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pg-card.pick .pg-chk { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line-2); background: #fff; }
.pg-card.pick.on { background: var(--brand-soft); border-color: var(--brand-ring); }
.pg-card.pick.on .pg-chk { background: var(--brand); border-color: var(--brand); }
.pg-card.pick.on .pg-chk::after { content: ""; position: absolute; left: 7px; top: 3.5px; width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(45deg); }
.gop-key { display: inline-flex; align-items: center; gap: 6px; }
.gop-key .ic { width: 18px; height: 18px; }
kbd { font: inherit; font-size: 12px; padding: 2px 8px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  background: #fff; color: var(--text-2); }
@media (max-width: 700px) {
  .pg-grid { grid-template-columns: 1fr; }
  .dash { padding-top: 12px; }
  .dash-card { padding: 14px; }
  .dash-q { flex: 1 1 100%; }
  .dash-bar .grow { display: none; }
  .dash-bar .btn { flex: 1; }
  .pg-av { width: 52px; height: 52px; }
  .gop-key { display: none; }
}
.btn[hidden] { display: none; }
.dlg-h .icon-btn:focus-visible { outline: none; background: var(--bg-soft-2); }

/* trang công khai: chính sách quyền riêng tư / xóa dữ liệu */
body.doc-page { background: #f6f8f7; margin: 0; padding: 32px 16px; }
.doc-page article { max-width: 720px; margin: 0 auto; background: #fff; border-radius: 16px; padding: 32px; line-height: 1.65; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.doc-page .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: inherit; text-decoration: none; }
.doc-page .brand img { width: 36px; height: 36px; border-radius: 10px; }
.doc-page h1 { font-size: 26px; margin: 24px 0 8px; }
.doc-page h2 { font-size: 17px; margin: 22px 0 6px; }
.doc-page a { color: var(--brand); }
.login-links { font-size: 12.5px; color: #888; text-align: center; }
.login-links a { color: inherit; }
