/* ============================================
   GIAO DIỆN CHUYÊN NGHIỆP - SPA MARKETING HUB
   Tông màu chủ đạo: xanh lá nhẹ nhàng
   ============================================ */
:root {
    --primary: #2f9e6e;
    --primary-dark: #22815a;
    --primary-light: #e6f5ee;
    --primary-lighter: #f2faf6;
    --bg: #f4f6f5;
    --card-bg: #ffffff;
    --text: #1f2a24;
    --text-muted: #6b7972;
    --border: #e3e9e6;
    --green: #2f9e6e;
    --orange: #d78a2b;
    --red: #d1493f;
    --blue: #3a72c4;
    --gray: #8a938d;
    --sidebar-width: 232px;
    --topbar-height: 60px;
}
* { box-sizing: border-box; }
html { overflow-x: hidden; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    overflow-x: hidden;
    max-width: 100vw;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand {
    font-weight: 700;
    font-size: 17px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar .brand::before {
    content: "";
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #7bc9a3);
}
.topbar .user-info { font-size: 13.5px; color: var(--text-muted); display: flex; align-items: center; gap: 14px; }
.topbar .user-info::before {
    content: "";
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #7bc9a3);
}
.topbar .user-info .name { font-weight: 600; color: var(--text); }
.topbar .user-info a {
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.topbar .user-info a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; border-color: var(--primary-light); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-height)); }
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    flex-shrink: 0;
}
.sidebar .sidebar-section-label {
    padding: 14px 22px 8px;
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 2px 12px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
}
.sidebar a .ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.sidebar a:hover .ico, .sidebar a.active .ico { color: var(--primary-dark); }
.sidebar a:hover {
    background: var(--primary-lighter);
    text-decoration: none;
    color: var(--primary-dark);
}
.sidebar a.active {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(47,158,110,.25);
}
.sidebar a.active .ico { color: #fff; }
.main { flex: 1; min-width: 0; padding: 26px 30px; }

.page-title { font-size: 21px; margin: 0 0 4px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 13.5px; margin: 0 0 20px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(20, 40, 30, 0.04);
}
.card h3 { font-size: 15px; }

/* ---------- Stat cards (dashboard) ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    color: var(--text);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(20,40,30,.04);
    transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: 0 6px 18px rgba(20,40,30,.09); transform: translateY(-1px); }
.stat-card .stat-icon-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-card .stat-icon-badge svg { width: 20px; height: 20px; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; max-width: calc(100% - 54px); min-height: 32px; line-height: 1.3; display: flex; align-items: flex-start; }
.stat-card .stat-value { font-size: 25px; font-weight: 800; }
.stat-card.c1 .stat-value { color: #1c7d52; } .stat-card.c1 .stat-icon-badge { background: #dcf3e6; color: #1c7d52; } .stat-card.c1 { border-top: 3px solid #1c7d52; }
.stat-card.c2 .stat-value { color: #2a5faa; } .stat-card.c2 .stat-icon-badge { background: #dde9fa; color: #2a5faa; } .stat-card.c2 { border-top: 3px solid #2a5faa; }
.stat-card.c3 .stat-value { color: #b06a1c; } .stat-card.c3 .stat-icon-badge { background: #faeed8; color: #b06a1c; } .stat-card.c3 { border-top: 3px solid #b06a1c; }
.stat-card.c4 .stat-value { color: #6446a8; } .stat-card.c4 .stat-icon-badge { background: #ebe3f8; color: #6446a8; } .stat-card.c4 { border-top: 3px solid #6446a8; }
.stat-card.c5 .stat-value { color: #0d7d73; } .stat-card.c5 .stat-icon-badge { background: #d7f0ee; color: #0d7d73; } .stat-card.c5 { border-top: 3px solid #0d7d73; }
.stat-card.c6 .stat-value { color: #3730a3; } .stat-card.c6 .stat-icon-badge { background: #e0dffa; color: #3730a3; } .stat-card.c6 { border-top: 3px solid #3730a3; }
.stat-card.c7 .stat-value { color: #92400e; } .stat-card.c7 .stat-icon-badge { background: #fbe8c6; color: #92400e; } .stat-card.c7 { border-top: 3px solid #92400e; }
.stat-card.c8 .stat-value { color: #9d174d; } .stat-card.c8 .stat-icon-badge { background: #fbdce9; color: #9d174d; } .stat-card.c8 { border-top: 3px solid #9d174d; }

/* ---------- Dịch vụ đóng góp doanh thu cao nhất (thanh ngang) ---------- */
.metric-bar-list, .revenue-bar-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.metric-bar-item, .revenue-bar-item { min-width: 0; }
.metric-bar-item .mb-top, .revenue-bar-item .rb-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 5px; gap: 8px; min-width: 0; }
.metric-bar-item .mb-name, .revenue-bar-item .rb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
.metric-bar-item .mb-value, .revenue-bar-item .rb-value { color: var(--primary-dark); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.metric-bar-track, .revenue-bar-track { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; width: 100%; }
.metric-bar-fill, .revenue-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 6px; max-width: 100%; }

/* ---------- Công suất theo Thứ trong tuần (cột) ---------- */
.weekday-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.weekday-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.weekday-bar-col .wb-count { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.weekday-bar-col .wb-bar { width: 65%; background: linear-gradient(180deg, #a9d9c0, #6fb894); border-radius: 6px 6px 2px 2px; min-height: 4px; transition: height .2s; }
.weekday-bar-col .wb-label { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; }
.weekday-bar-col.wb-peak .wb-bar { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }
.weekday-bar-col.wb-peak .wb-count { color: var(--primary-dark); }
@media (max-width: 480px) {
    .weekday-bars { gap: 4px; }
    .weekday-bar-col .wb-count { font-size: 9.5px; }
    .weekday-bar-col .wb-label { font-size: 9px; }
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 26px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title a { font-size: 13px; font-weight: 500; }

.list-card { display: block; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.list-card:last-child { border-bottom: none; }
.list-card:hover { background: var(--primary-lighter); text-decoration: none; }
.list-row { display: flex; justify-content: space-between; align-items: center; color: var(--text); }
.list-row .l-title { font-weight: 600; font-size: 13.5px; }
.list-row .l-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; background: var(--bg); font-size: 12.5px; text-transform: uppercase; letter-spacing: .02em; }
tr:hover td { background: var(--primary-lighter); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #b53a31; }
.btn-gray { background: var(--gray); }
.btn-gray:hover { background: #6f776f; }
.btn-outline { background: #fff; color: var(--primary-dark); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lighter); color: var(--primary-dark); }

form.inline { display: inline; }
input[type=text], input[type=date], input[type=password], input[type=number], textarea, select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: inherit;
    margin-bottom: 12px;
    background: #fff;
    color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
label { font-size: 12.5px; color: var(--text-muted); display: block; margin-bottom: 5px; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
}
.badge.green { background: var(--green); }
.badge.orange { background: var(--orange); }
.badge.red { background: var(--red); }
.badge.blue { background: var(--blue); }
.badge.gray { background: var(--gray); }
.badge.purple { background: #7c4dff; }
.badge.teal { background: #0d9488; }
.badge.pink { background: #d6336c; }
.badge.indigo { background: #4338ca; }
.badge.brown { background: #92400e; }
.badge.cyan { background: #0e7490; }

/* ---------- Login ---------- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--primary-lighter), var(--bg));
}
.login-box {
    background: var(--card-bg);
    padding: 40px 36px;
    border-radius: 16px;
    width: 360px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(20, 60, 40, 0.08);
}
.login-box .brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #7bc9a3);
    margin: 0 auto 16px;
}
.login-box h2 { margin-top: 0; text-align: center; color: var(--text); font-size: 19px; }
.error-msg { background: #fdecec; color: var(--red); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ---------- Comments ---------- */
.comment-box { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.comment-box h4 { margin: 0 0 12px; font-size: 13.5px; color: var(--text); }
.comment { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; max-width: 80%; }
.comment.from-admin { background: var(--primary-lighter); margin-right: auto; border: 1px solid var(--primary-light); }
.comment.from-client { background: #f3f0ea; margin-left: auto; }
.comment-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form textarea { margin-bottom: 0; flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

/* ---------- Callout ---------- */
.callout {
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    font-size: 13.5px;
}
.callout.warn { background: #fdf6ec; border-color: #f2dfb8; color: #8a6416; }

/* ---------- Ô tìm kiếm khách hàng (autocomplete) ---------- */
.customer-search-wrap { position: relative; }
.customer-search-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20,40,30,.12); max-height: 260px; overflow-y: auto;
    margin-top: 4px; display: none;
}
.customer-search-results.open { display: block; }
.customer-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.customer-result-item:last-child { border-bottom: none; }
.customer-result-item:hover, .customer-result-item.active { background: var(--primary-lighter); }
.customer-result-item .cr-name { font-weight: 600; font-size: 13.5px; }
.customer-result-item .cr-meta { font-size: 12px; color: var(--text-muted); }
.selected-customer-card {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--primary-lighter); border: 1px solid var(--primary-light);
    border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
}
.selected-customer-card .scc-name { font-weight: 700; font-size: 13.5px; }
.selected-customer-card .scc-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- Khung giờ chọn nhanh ---------- */
.time-slot-group { margin-bottom: 14px; }
.time-slot-group-label { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.time-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.time-slot-btn {
    padding: 8px 6px; border: 1px solid var(--border); border-radius: 20px;
    background: #fff; color: var(--text); font-size: 13px; text-align: center; cursor: pointer;
}
.time-slot-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.time-slot-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

/* ---------- Giỏ dịch vụ (chọn dịch vụ kiểu thêm vào giỏ) ---------- */
.service-pick-list { display: flex; flex-direction: column; gap: 8px; }
.service-pick-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.service-pick-item .spi-info { flex: 1; }
.service-pick-item .spi-name { font-weight: 600; font-size: 13.5px; }
.service-pick-item .spi-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.service-pick-item .spi-price { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.service-pick-item .btn-add-cart { background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.cart-box { border: 1px solid var(--primary-light); background: var(--primary-lighter); border-radius: 10px; padding: 14px; margin: 14px 0; }
.cart-box h4 { margin: 0 0 10px; font-size: 13.5px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--primary-light); }
.cart-item:last-child { border-bottom: none; }
.cart-item .ci-name { flex: 1; font-size: 13.5px; }
.cart-item .ci-qty-btns { display: flex; align-items: center; gap: 6px; }
.cart-item .ci-qty-btns button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.cart-item .ci-qty { min-width: 20px; text-align: center; font-weight: 700; }
.cart-item .ci-subtotal { width: 100px; text-align: right; font-weight: 600; font-size: 13px; }
.cart-item .ci-remove { color: var(--red); cursor: pointer; font-size: 12px; }
.cart-empty { color: var(--text-muted); font-size: 13px; padding: 6px 0; }

/* ---------- Nút ẩn/hiện menu + hành vi thu gọn sidebar ---------- */
.sidebar-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--border);
    background: #fff; color: var(--text); cursor: pointer; margin-right: 10px; flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: var(--primary-lighter); }
.sidebar { transition: margin-left .2s ease, transform .2s ease; }
body.sidebar-closed .sidebar { margin-left: -232px; }
.sidebar-overlay { display: none; }

/* ---------- Responsive: tablet & mobile ---------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        height: calc(100vh - var(--topbar-height));
        z-index: 60;
        transform: translateX(-100%);
        margin-left: 0 !important;
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
        overflow-y: auto;
    }
    body:not(.sidebar-closed) .sidebar { transform: translateX(0); }
    body:not(.sidebar-closed) .sidebar-overlay {
        display: block; position: fixed; inset: 0; top: var(--topbar-height);
        background: rgba(15,25,20,.4); z-index: 55;
    }
    .main { padding: 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; }
    .topbar .brand { font-size: 15px; }
    .topbar .user-info { font-size: 12.5px; gap: 8px; }
    .topbar .user-info .name { display: none; }
    .card { padding: 16px; }
    table { font-size: 12px; }
    th, td { padding: 8px 8px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .metrics-summary { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { gap: 6px; }
    .filter-bar form { width: 100%; }

    /* Chặn iOS Safari tự zoom vào khi bấm ô nhập (yêu cầu cỡ chữ >=16px) */
    input[type=text], input[type=date], input[type=time], input[type=password],
    input[type=number], input[type=file], textarea, select { font-size: 16px; }

    /* Bộ lọc dạng GET (tìm kiếm + select) xếp full-width, dễ bấm hơn trên di động */
    form[method="get"] select,
    form[method="get"] input[type="text"] { width: 100% !important; margin-bottom: 8px !important; }
    form[method="get"] { flex-direction: column; align-items: stretch !important; }
    form[method="get"] .btn, form[method="get"] .btn-sm { width: 100%; text-align: center; }

    /* Giỏ dịch vụ & danh sách dịch vụ chọn: xếp dọc cho dễ chạm */
    .service-pick-item { flex-wrap: wrap; }
    .service-pick-item .spi-info { min-width: 100%; order: 1; }
    .service-pick-item .spi-price { order: 2; }
    .service-pick-item .btn-add-cart { order: 3; margin-left: auto; padding: 8px 16px; }
    .cart-item { flex-wrap: wrap; row-gap: 6px; }
    .cart-item .ci-name { min-width: 100%; }
    .cart-item .ci-subtotal { width: auto; margin-left: auto; }

    /* Vùng bấm rộng hơn cho nút icon và hành động trên danh sách */
    .icon-btn { width: 34px; height: 34px; }
    .row-actions { flex-wrap: wrap; gap: 8px; }
    .time-slot-btn { padding: 10px 6px; min-height: 38px; }

    /* Ô tìm kiếm khách hàng full width, dễ đọc kết quả trên màn nhỏ */
    .customer-result-item { padding: 12px 14px; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .metrics-summary { grid-template-columns: 1fr; }
    .channel-grid { grid-template-columns: 1fr; }
}
/* Bảng dài tự cuộn ngang thay vì vỡ giao diện trên màn hình nhỏ */
.card { overflow-x: auto; }

/* ---------- Popup thông báo (toast) ---------- */
.toast-notification {
    position: fixed; top: 20px; right: 20px; z-index: 200;
    background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(20,40,30,.18);
    padding: 16px 20px; display: flex; align-items: flex-start; gap: 12px;
    max-width: 380px; border-left: 4px solid var(--primary);
    transform: translateX(420px); opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.toast-notification.show { transform: translateX(0); opacity: 1; }
.toast-notification.error { border-left-color: #d64545; }
.toast-notification .toast-ico { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primary-lighter); color: var(--primary-dark); }
.toast-notification.error .toast-ico { background: #fbe3e3; color: #d64545; }
.toast-notification .toast-ico svg { width: 15px; height: 15px; }
.toast-notification .toast-msg { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; padding-top: 3px; }
@media (max-width: 600px) {
    .toast-notification { left: 12px; right: 12px; top: 12px; max-width: none; transform: translateY(-100px); }
    .toast-notification.show { transform: translateY(0); }
}

/* ---------- Câu hỏi - Trả lời dạng gập (accordion) — câu hỏi trên, nút thao tác dưới ---------- */
.qa-item { border: none; border-bottom: 1px solid var(--border); }
.qa-item:last-child { border-bottom: none; }
.qa-item summary { list-style: none; cursor: pointer; padding: 14px 16px; }
.qa-item summary::-webkit-details-marker { display: none; }
.qa-item .qa-summary-top { display: flex; align-items: center; gap: 10px; }
.qa-item .qa-code { font-weight: 700; color: var(--primary-dark); font-size: 13px; flex-shrink: 0; }
.qa-item .qa-question { flex: 1; font-size: 13.5px; font-weight: 600; min-width: 0; }
.qa-item .qa-caret { color: var(--text-muted); transition: transform .15s; flex-shrink: 0; }
.qa-item[open] .qa-caret { transform: rotate(90deg); }
.qa-item .qa-summary-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qa-item .qa-answer { padding: 0 16px 16px 16px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; color: var(--text); }
@media (max-width: 600px) {
    .qa-item summary { padding: 12px; }
    .qa-item .qa-answer { padding: 0 12px 14px; }
    .copy-btn { padding: 8px 12px; }
}

.seo-form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.seo-sidebar-stack { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }
@media (max-width: 900px) { .seo-form-layout { grid-template-columns: 1fr; } .seo-sidebar-stack { position: static; } }

/* ---------- Stat card dạng nhỏ gọn (compact) kèm link chi tiết ---------- */
.stat-card.compact { padding: 14px 16px; }
.stat-card.compact .stat-icon-badge { width: 32px; height: 32px; top: 12px; right: 12px; border-radius: 9px; }
.stat-card.compact .stat-icon-badge svg { width: 15px; height: 15px; }
.stat-card.compact .stat-label { font-size: 11px; margin-bottom: 6px; max-width: calc(100% - 42px); min-height: 28px; line-height: 1.3; display: flex; align-items: flex-start; }
.stat-card.compact .stat-value { font-size: 19px; }
.stat-card.compact .stat-link { display: block; margin-top: 8px; font-size: 11.5px; font-weight: 700; color: var(--primary-dark); }
.stat-card.compact .stat-link:hover { text-decoration: underline; }

/* ---------- Thao tác nhanh ---------- */
.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; margin: 4px 0 22px; }
.quick-action-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; background: #fff; border: 1px solid var(--border); border-radius: 14px; text-align: center; color: var(--text); }
.quick-action-btn:hover { border-color: var(--primary); background: var(--primary-lighter); text-decoration: none; color: var(--primary-dark); }
.quick-action-btn .qa-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-lighter); display: flex; align-items: center; justify-content: center; color: var(--primary-dark); flex-shrink: 0; }
.quick-action-btn .qa-ico svg { width: 17px; height: 17px; }
.quick-action-btn .qa-label { font-size: 12px; font-weight: 600; line-height: 1.3; }

/* ---------- Mini thống kê tổng quan kênh (4 ô nhỏ phía trên danh sách kênh) ---------- */
.mini-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.mini-stat { text-align: center; padding: 10px 6px; background: var(--bg); border-radius: 10px; }
.mini-stat .ms-value { font-size: 17px; font-weight: 800; color: var(--primary-dark); }
.mini-stat .ms-label { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Danh sách kênh gộp 1 cột dọc, mỗi kênh 1 hàng ngang (phân biệt bằng màu) ---------- */
.channel-flat-list { display: flex; flex-direction: column; }
.channel-flat-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.channel-flat-item:last-child { border-bottom: none; }
.channel-flat-item:hover { text-decoration: none; }
.channel-flat-item .cf-top-row { display: flex; align-items: center; gap: 10px; }
.channel-flat-item .cf-ico { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.channel-flat-item .cf-ico svg { width: 16px; height: 16px; fill: #fff; stroke: #fff; }
.channel-flat-item .cf-name-wrap { min-width: 0; flex: 1; }
.channel-flat-item .cf-name { font-size: 13.5px; font-weight: 600; display: block; }
.channel-flat-item .cf-meta { font-size: 10.5px; color: var(--text-muted); }
.channel-flat-item .cf-metrics-row { display: flex; gap: 22px; padding-left: 42px; flex-wrap: wrap; }
.channel-flat-item .cf-metric-block { display: flex; flex-direction: column; }
.channel-flat-item .cf-metric-value { font-size: 13.5px; font-weight: 700; color: var(--text); }
.channel-flat-item .cf-metric-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; margin-top: 1px; }
.channel-flat-item .cf-no-data { padding-left: 42px; font-size: 12px; color: var(--text-muted); }

/* ---------- Thông báo / hoạt động gần đây ---------- */
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-item .act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.activity-item .act-text { font-size: 12.5px; line-height: 1.5; }
.activity-item .act-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Bố cục 2 cột / 3 cột cho Tổng quan ---------- */
.dash-2col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; min-width: 0; }
.dash-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; min-width: 0; }
.dash-2col > div, .dash-3col > div { min-width: 0; }
@media (max-width: 900px) {
    .dash-2col, .dash-3col { grid-template-columns: 1fr; }
}
/* ---------- Hàng dịch vụ sửa được khi xác nhận thanh toán ---------- */
/* ---------- Bảng chuyển thành dạng thẻ trên mobile (Khách hàng, Đơn hàng, Gói dịch vụ) ---------- */
@media (max-width: 760px) {
    table.responsive-table { border: none; }
    table.responsive-table thead,
    table.responsive-table tr.rt-head-row { display: none !important; }
    table.responsive-table, table.responsive-table tbody { display: block; width: 100%; }
    table.responsive-table tr:not(.rt-head-row):not(.rt-empty-row) {
        display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px;
        margin-bottom: 12px; border: 1px solid var(--border); border-radius: 14px;
        padding: 14px; background: #fff; box-shadow: 0 1px 3px rgba(20,40,30,.03);
    }
    table.responsive-table tr.rt-empty-row { display: block; padding: 8px 0; }
    table.responsive-table td { display: block; width: auto; box-sizing: border-box; border: none !important; padding: 5px 0 !important; text-align: left !important; }
    table.responsive-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); margin-bottom: 1px; }
    table.responsive-table td.rt-no-label::before { content: none; }
    table.responsive-table td.rt-span2 { grid-column: 1 / -1; }
    table.responsive-table td.rt-title { order: -2; grid-column: 1 / -1; font-size: 15px; font-weight: 700; padding-bottom: 8px !important; border-bottom: 1px solid var(--border) !important; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
    table.responsive-table td.rt-title::before { content: none; }
    table.responsive-table td.rt-actions { order: 99; grid-column: 1 / -1; padding-top: 10px !important; border-top: 1px solid var(--border) !important; margin-top: 6px; }
    table.responsive-table td.rt-actions .row-actions { flex-wrap: wrap; }
}

/* ---------- Tab chọn chế độ tạo đơn: Dịch vụ lẻ / Bán gói dịch vụ ---------- */
/* ---------- Chọn nguồn khách khi import Excel ---------- */
.source-pick-group { display: flex; flex-wrap: wrap; gap: 10px; }
.source-pick-opt { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.source-pick-opt input { width: auto; margin: 0; }
.source-pick-opt.skip-opt { color: var(--red); padding-left: 10px; border-left: 1px dashed var(--border); }

.order-mode-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.mode-tab { background: none; border: none; padding: 10px 4px; margin-right: 16px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.mode-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* ---------- Chọn gói dịch vụ khi tạo đơn ---------- */
.package-pick-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.package-pick-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.package-pick-item:has(input:checked) { border-color: var(--primary); background: var(--primary-lighter); }
.package-pick-item input[type="radio"] { width: auto; margin: 0; flex-shrink: 0; }
.package-pick-item .ppi-info { flex: 1; min-width: 0; }
.package-pick-item .ppi-name { font-size: 13.5px; font-weight: 600; }
.package-pick-item .ppi-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.package-pick-item .ppi-price { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }

/* ---------- Danh sách Gói dịch vụ đã mua của khách (trang chi tiết khách hàng) ---------- */
.package-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.package-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.package-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.package-item .pkg-name { font-size: 14px; font-weight: 700; }
.package-item .pkg-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.package-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.package-progress-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.package-progress-bar div { height: 100%; background: var(--primary); }
.package-progress-text { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

.pay-item-row { display: grid; grid-template-columns: 1fr 110px 70px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-item-row input { margin-bottom: 0; }
@media (max-width: 600px) {
    .pay-item-row { grid-template-columns: 1fr 1fr; }
}

.seo-score { font-size: 14px; font-weight: 600; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.seo-checklist-list { display: flex; flex-direction: column; }
.seo-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.seo-item:last-child { border-bottom: none; }
.seo-icon { flex-shrink: 0; width: 19px; height: 19px; margin-top: 1px; display: inline-block; }
.seo-icon svg { width: 100%; height: 100%; display: block; }
.seo-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.seo-label { display: block; font-weight: 600; font-size: 13px; line-height: 1.3; }
.seo-detail { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.3; }
.seo-item.seo-fail .seo-label { color: #c0392b; }
.seo-item.seo-warn .seo-label { color: #b06a1c; }
.seo-item.seo-pass .seo-label { color: #1c7d52; }

/* ---------- Nút lướt lên đầu trang ---------- */
.scroll-top-btn {
    position: fixed; right: 22px; bottom: 22px; z-index: 60;
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--primary); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(20,60,40,.25);
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: opacity .2s, transform .2s, visibility .2s;
}
.scroll-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top-btn:hover { background: var(--primary-dark); }
.scroll-top-btn svg { width: 20px; height: 20px; }

/* ---------- Accordion Hướng dẫn ---------- */
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
details summary .ico-caret { margin-left: auto; transition: transform .15s; }
details[open] summary .ico-caret { transform: rotate(90deg); }

/* ---------- Icon buttons (sửa / xóa / di chuyển) ---------- */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    vertical-align: middle;
}
.icon-btn:hover { background: var(--primary-lighter); color: var(--primary-dark); border-color: var(--primary-light); text-decoration: none; }
.icon-btn.danger:hover { background: #fdecec; color: var(--red); border-color: #f6d3d0; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.order-col { width: 60px; }

/* ---------- Nhóm nền tảng & thẻ kênh (dashboard tăng trưởng) ---------- */
.platform-group { margin-bottom: 20px; }
.platform-group-head {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 2px 10px;
}
.platform-group-head .p-ico {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--primary-light); color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.platform-group-head .p-title { font-weight: 700; font-size: 14px; }
.platform-group-head .p-total { color: var(--text-muted); font-size: 12.5px; margin-left: auto; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.channel-card {
    display: block; border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 16px; background: #fff; color: var(--text);
}
.channel-card:hover { border-color: var(--primary); text-decoration: none; box-shadow: 0 2px 8px rgba(20,60,40,0.06); }
.channel-card .c-name { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.channel-card .c-value { font-size: 22px; font-weight: 700; }
.channel-card .c-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 20px; margin-left: 8px; vertical-align: middle; }
.channel-card .c-trend.green { background: #e6f5ee; color: var(--green); }
.channel-card .c-trend.red { background: #fdecec; color: var(--red); }
.channel-card .c-trend.gray { background: var(--bg); color: var(--text-muted); }
.channel-card .c-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.channel-card .c-empty { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.channel-card .c-metrics-row { display: flex; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.channel-card .c-metric { flex: 1; min-width: 70px; }
.channel-card .c-metric-value { font-size: 19px; font-weight: 700; }
.channel-card .c-metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
.channel-card .c-metric .c-trend { font-size: 11px; padding: 1px 6px; margin-left: 0; margin-top: 2px; display: inline-flex; }

/* ---------- Bảng chỉ số tổng hợp (Ads Plan) ---------- */
.metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 18px;
}
.metrics-summary .m-item { background: #fff; padding: 14px 16px; }
.metrics-summary .m-item.highlight { background: var(--primary-lighter); }
.metrics-summary .m-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .02em; }
.metrics-summary .m-value { font-size: 18px; font-weight: 700; }
.metrics-summary .m-value.highlight { color: var(--primary-dark); }
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-bar select { width: auto; margin-bottom: 0; }

/* ---------- Bộ lọc chuyên nghiệp (dạng lưới có nhãn) ---------- */
.filter-pro { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.filter-pro .fp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.filter-pro .fp-field label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); margin-bottom: 4px; display: block; }
.filter-pro .fp-field input, .filter-pro .fp-field select { margin-bottom: 0; }
.filter-pro .fp-actions { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border); }
.filter-pro .fp-actions .btn, .filter-pro .fp-actions .btn-outline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.filter-pro .fp-actions .btn svg, .filter-pro .fp-actions .btn-outline svg { width: 14px; height: 14px; flex-shrink: 0; }
.filter-pro .fp-active-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.filter-pro .fp-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-lighter); color: var(--primary-dark); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 20px; }
.filter-pro .fp-tag a { color: var(--primary-dark); opacity: .6; text-decoration: none; font-weight: 800; }
.filter-pro .fp-tag a:hover { opacity: 1; }

/* ---------- Phân trang ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: 13px; color: var(--text);
}
.pagination a:hover { background: var(--primary-lighter); text-decoration: none; border-color: var(--primary-light); }
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination span.disabled { color: var(--text-muted); opacity: .5; }
