/* =========================================================
 * Nhóm trang Hệ thống: Tài khoản, Zalo ZNS, Xuất / Nhập dữ liệu, Cài đặt
 * Tiền tố .sy- (chỉ dùng trong templates users/zalo/data/settings)
 * ========================================================= */

/* ---------- Dùng chung ---------- */
.ox-ic--slate { background: var(--ox-gray-soft); color: var(--ox-muted); }
.sy-help { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; border-radius: 50%; background: var(--ox-gray-soft); color: var(--ox-muted); font: 700 11px/1 var(--ox-font); font-style: normal; cursor: help; vertical-align: 1px; }
.sy-help:hover { background: var(--ox-primary-soft); color: var(--ox-primary); }
.sy-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.sy-head > div { min-width: 0; flex: 1; }
.sy-head h2 { font-size: 16.5px; line-height: 1.3; }
.sy-head p, .sy-head small { display: block; margin-top: 2px; color: var(--ox-muted); font-size: 13px; line-height: 1.5; }
.sy-head > .ox-badge { flex: none; }

/* ---------- Ô số liệu lọc theo vai trò ---------- */
.sy-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.sy-stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--ox-border); border-radius: 18px; background: var(--ox-surface); box-shadow: var(--ox-shadow); color: var(--ox-text); font: inherit; text-align: left; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.sy-stat:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -16px rgba(23, 32, 46, .3); }
.sy-stat .ox-ic { width: 46px; height: 46px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.sy-stat:hover .ox-ic { transform: scale(1.08) rotate(-8deg); }
.sy-stat__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sy-stat strong { font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sy-stat small { color: var(--ox-muted); font-size: 12.5px; font-weight: 500; }
.sy-stat.is-active { border-color: #ffc6a8; box-shadow: 0 0 0 2px var(--ox-primary-soft), var(--ox-shadow); }
.sy-stat:focus-visible { outline: 2px solid var(--ox-primary); outline-offset: 2px; }

/* ---------- Thẻ tài khoản ---------- */
.sy-users { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 24px; align-items: start; }
.sy-ugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; align-content: start; }
.sy-ugrid__none { grid-column: 1 / -1; }
.sy-ucard { display: flex; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--ox-border); border-radius: 18px; background: var(--ox-surface); box-shadow: var(--ox-shadow); transition: transform .2s, box-shadow .2s, border-color .2s; min-width: 0; }
.sy-ucard:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -18px rgba(23, 32, 46, .32); }
.sy-ucard.is-selected { border-color: #ffc6a8; box-shadow: 0 0 0 3px var(--ox-primary-soft), var(--ox-shadow); }
.sy-ucard[hidden] { display: none; }
.sy-ucard__top { display: flex; align-items: center; gap: 12px; }
.sy-ucard__id { flex: 1; min-width: 0; line-height: 1.35; }
.sy-ucard__id a { color: var(--ox-text) !important; font-weight: 700; font-size: 15.5px; }
.sy-ucard__id a:hover { color: var(--ox-primary) !important; }
.sy-ucard__id small { display: block; color: var(--ox-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sy-me { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px; background: var(--ox-primary-soft); color: var(--ox-primary-hover); font: 600 11px/1.6 var(--ox-font); font-style: normal; vertical-align: 2px; }
.sy-ucard__top > .ox-badge { flex: none; align-self: flex-start; }
.sy-ucard__meta { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px 14px; list-style: none; border-radius: 12px; background: var(--ox-surface-2); font-size: 13px; }
.sy-ucard__meta li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sy-ucard__meta .ox-icon { flex: none; color: var(--ox-slate); }
.sy-ucard__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sy-ucard__meta i { color: var(--ox-slate); font-style: normal; }
.sy-ucard__foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.sy-ucard__foot form { display: inline-flex; }
.sy-act { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--ox-border); border-radius: 10px; background: var(--ox-surface); color: var(--ox-muted) !important; font: 600 13px var(--ox-font); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.sy-act:hover { border-color: #ffc6a8; background: var(--ox-primary-soft); color: var(--ox-primary) !important; }
.sy-act--edit { margin-right: auto; padding: 0 14px; color: var(--ox-text) !important; }
.sy-act--danger:hover { border-color: #f6c3bd; background: var(--ox-red-soft); color: var(--ox-red) !important; }
.sy-ucard__note { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--ox-slate); font-size: 12px; cursor: help; }
.sy-ucard--add { align-items: center; justify-content: center; gap: 6px; min-height: 220px; border: 1.5px dashed #e6d6ca; background: rgba(255, 255, 255, .55); box-shadow: none; color: var(--ox-text); font: inherit; text-align: center; cursor: pointer; }
.sy-ucard--add .ox-ic { width: 48px; height: 48px; margin-bottom: 4px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.sy-ucard--add strong { font-size: 15px; }
.sy-ucard--add small { color: var(--ox-muted); font-size: 12.5px; }
.sy-ucard--add:hover { border-color: var(--ox-primary); background: #fff; }
.sy-ucard--add:hover .ox-ic { transform: rotate(90deg) scale(1.08); }

/* Avatar gradient theo màu vai trò */
.sy-ava { display: grid; place-items: center; flex: none; width: 50px; height: 50px; border-radius: 50%; background: var(--ox-grad); color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .02em; box-shadow: 0 0 0 3px #fff, 0 8px 18px -8px rgba(232, 64, 28, .6); }
.sy-ava--red { background: linear-gradient(135deg, #ff8a3d, #e8401c); }
.sy-ava--blue { background: linear-gradient(135deg, #60a5fa, #2563eb); box-shadow: 0 0 0 3px #fff, 0 8px 18px -8px rgba(37, 99, 235, .6); }
.sy-ava--green { background: linear-gradient(135deg, #34d399, #12915f); box-shadow: 0 0 0 3px #fff, 0 8px 18px -8px rgba(18, 145, 95, .6); }
.sy-ava--slate { background: linear-gradient(135deg, #b8c0cc, #7c8696); box-shadow: 0 0 0 3px #fff; }

/* Bảng quyền theo vai trò */
.sy-perm { position: sticky; top: 24px; padding: 20px 0 6px !important; overflow: hidden; }
.sy-perm .ox-card__title { margin: 0 20px 14px; }
.sy-perm .ox-table-wrap { margin: 0; }
.sy-perm__table tr:last-child td { border-bottom: 0; }
.sy-perm__table th, .sy-perm__table td { padding: 10px 6px; vertical-align: middle; }
.sy-perm__table th:first-child, .sy-perm__table td:first-child { padding-left: 20px; }
.sy-perm__table th:last-child, .sy-perm__table td:last-child { padding-right: 20px; }
.sy-perm__table th { text-transform: none; letter-spacing: 0; }
.sy-perm__table .ox-badge { padding: 3px 8px; font-size: 11.5px; }
.sy-perm__table .ox-badge::before { display: none; }
.sy-perm__col { width: 1%; text-align: center; white-space: nowrap; }
.sy-perm__area { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.35; }
.sy-perm__area .sy-help { margin-left: -2px; }
.sy-perm__area .ox-icon { flex: none; color: var(--ox-slate); }
.sy-perm__mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #cdd2da; font-weight: 600; }
.sy-perm__mark.is-on { background: var(--ox-green-soft); color: var(--ox-green); }

/* Hộp thoại thêm / sửa */
.sy-udialog { width: min(720px, calc(100% - 24px)); }
.sy-udialog__head { gap: 14px; justify-content: flex-start; }
.sy-udialog__head .sy-ava { width: 46px; height: 46px; font-size: 15px; }
.sy-udialog__title { flex: 1; min-width: 0; }
.sy-udialog__title small { display: block; color: var(--ox-muted); font-size: 13px; margin-top: 2px; }
.sy-udialog__body { display: flex; flex-direction: column; gap: 18px; padding-top: 20px; padding-bottom: 22px; }
.sy-udialog .ox-input-icon input { width: 100%; }
.sy-roles-wrap { margin: 0; padding: 0; border: 0; min-width: 0; }
.sy-roles-wrap legend { margin-bottom: 8px; padding: 0; }
.sy-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sy-role { position: relative; cursor: pointer; }
.sy-role input { position: absolute; opacity: 0; pointer-events: none; }
.sy-role__box { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; height: 100%; padding: 16px 14px 14px; border: 1.5px solid var(--ox-border); border-radius: 14px; background: var(--ox-surface); transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.sy-role__box .ox-ic { width: 40px; height: 40px; margin-bottom: 4px; }
.sy-role__box strong { font-size: 14.5px; }
.sy-role__box small { color: var(--ox-muted); font-size: 12px; line-height: 1.45; }
.sy-role__check { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #d9dee6; color: transparent; transition: all .15s; }
.sy-role:hover .sy-role__box { border-color: #ffc6a8; transform: translateY(-1px); }
.sy-role input:checked + .sy-role__box { border-color: var(--ox-primary); background: var(--ox-primary-soft); box-shadow: 0 10px 20px -14px rgba(232, 64, 28, .7); }
.sy-role input:checked + .sy-role__box .sy-role__check { border-color: transparent; background: var(--ox-grad); color: #fff; }
.sy-role input:focus-visible + .sy-role__box { outline: 2px solid var(--ox-primary); outline-offset: 2px; }
.sy-role input:disabled + .sy-role__box { opacity: .45; cursor: not-allowed; transform: none; }
.sy-role:has(input:disabled) { cursor: not-allowed; }

@media (max-width: 1280px) {
    .sy-users { grid-template-columns: minmax(0, 1fr); }
    .sy-perm { position: static; }
}
@media (max-width: 760px) {
    .sy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .sy-stat { padding: 14px; gap: 10px; }
    .sy-stat .ox-ic { width: 40px; height: 40px; }
    .sy-stat strong { font-size: 20px; }
    .sy-ugrid { grid-template-columns: minmax(0, 1fr); }
    .sy-ucard--add { min-height: 120px; }
    .sy-roles { grid-template-columns: minmax(0, 1fr); }
    .sy-role__box { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 12px 40px 12px 12px; }
    .sy-role__box .ox-ic { margin: 0; }
    .sy-role__box small { flex-basis: 100%; }
}

/* =========================================================
 * Zalo ZNS
 * ========================================================= */
.sy-steps { display: flex; align-items: center; gap: 24px; padding: 16px 20px; }
.sy-steps__prog { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 6px; row-gap: 8px; flex: none; width: 150px; }
.sy-steps__prog strong { font-size: 24px; font-weight: 700; line-height: 1; }
.sy-steps__prog small { color: var(--ox-muted); font-size: 12.5px; }
.sy-steps__bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--ox-gray-soft); overflow: hidden; }
.sy-steps__bar i { display: block; height: 100%; border-radius: inherit; background: var(--ox-grad); }
.sy-steps ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; }
.sy-steps li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: var(--ox-text) !important; transition: background .15s; }
.sy-steps li a:hover { background: var(--ox-surface-2); }
.sy-steps li a > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sy-steps strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sy-steps li small { color: var(--ox-amber); font-size: 12px; font-weight: 500; }
.sy-steps li.is-done small { color: var(--ox-green); }
.sy-steps__no { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ox-amber-soft); color: var(--ox-amber); font-weight: 700; font-size: 14px; }
.sy-steps li.is-done .sy-steps__no { background: var(--ox-green-soft); color: var(--ox-green); }

.sy-zalo .ox-card__head h2, .sy-zalo.ox-card > .ox-card__head h2 { display: flex; align-items: center; gap: 10px; }
.sy-zalo .ox-card__head h2::before { content: none !important; }
.sy-zalo .ox-card__head h2 > .ox-icon { box-sizing: content-box; padding: 7px; border-radius: 10px; background: var(--ox-primary-soft); color: var(--ox-primary); }
.sy-no { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ox-grad); color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 6px 14px -8px rgba(232, 64, 28, .8); }
.sy-lead { display: block; margin: -6px 0 16px !important; font-size: 13px; }
.sy-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sy-modes legend { margin-bottom: 8px; }
.sy-modes .ox-option { padding: 12px; }
.sy-switch { align-self: flex-start; }
#template .ox-inline-form { align-items: flex-end; }

@media (max-width: 1100px) {
    .sy-steps { flex-direction: column; align-items: stretch; gap: 12px; }
    .sy-steps__prog { width: auto; }
    .sy-steps ol { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
    .sy-steps ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sy-modes { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================
 * Xuất / Nhập dữ liệu
 * ========================================================= */
.sy-data .sy-head .ox-ic { width: 44px; height: 44px; }
.sy-count { flex: none; padding: 6px 12px; border-radius: 99px; background: var(--ox-surface-2); border: 1px solid var(--ox-border); color: var(--ox-muted); font-size: 12.5px; cursor: help; }
.sy-count strong { color: var(--ox-text); font-size: 15px; }
.sy-opt { align-items: flex-start; }
.sy-opt > input { margin-top: 12px; }
.sy-opt > .ox-ic { width: 38px; height: 38px; }
.sy-opt > span:last-child { flex: 1; min-width: 0; }
.sy-warn { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--ox-amber); font-size: 12px; font-style: normal; font-weight: 500; }
.sy-modes--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sy-modes--3 legend { grid-column: 1 / -1; }
.sy-modes .ox-option strong { font-size: 13.5px; }
.sy-check { align-items: flex-start; }
.sy-check small { color: var(--ox-muted); font-size: 12px; }
.sy-empty { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--ox-green-soft); color: var(--ox-green); font-weight: 500; font-size: 13.5px; }
@media (max-width: 760px) {
    .sy-modes--3 { grid-template-columns: minmax(0, 1fr); }
    .sy-data .sy-head { flex-wrap: wrap; row-gap: 8px; }
    .sy-data .sy-head > div { flex-basis: calc(100% - 60px); }
    .sy-data .sy-head > .sy-count, .sy-data .sy-head > .ox-badge { margin-left: 58px; }
}

/* =========================================================
 * Cài đặt: mục lục dính bên trái
 * ========================================================= */
.sy-set { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 20px; align-items: start; }
.sy-toc { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--ox-border); border-radius: 18px; background: var(--ox-surface); box-shadow: var(--ox-shadow); }
.sy-toc__title { padding: 4px 10px 8px; color: var(--ox-slate); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sy-toc a { display: flex; align-items: center; gap: 9px; padding: 6px 8px 6px 6px; border-radius: 12px; color: var(--ox-muted) !important; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, color .15s; }
.sy-toc a .ox-ic { width: 30px; height: 30px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.sy-toc a:hover { background: var(--ox-surface-2); color: var(--ox-text) !important; }
.sy-toc a:hover .ox-ic { transform: scale(1.08); }
.sy-toc a.is-active { background: var(--ox-primary-soft); color: var(--ox-primary-hover) !important; }
.sy-set__main > section[id] { scroll-margin-top: 96px; }
.sy-set__main .sy-head .ox-ic { width: 44px; height: 44px; }
.sy-set__main .sy-head small a { font-weight: 600; }
.sy-set__main .sy-head small .ox-icon { vertical-align: -2px; color: var(--ox-primary); }
.sy-set__main .ox-channels { margin-top: 0; }
.sy-set__main .ox-field__label .sy-help { vertical-align: 0; }
.sy-set__main .ox-table--servers-edit th, .sy-set__main .ox-table--servers-edit td { padding-left: 4px; padding-right: 4px; }
.sy-set__main .ox-table--servers-edit th:first-child, .sy-set__main .ox-table--servers-edit td:first-child { padding-left: 0; }
.sy-set__main .ox-table--servers-edit .ox-badge { padding-left: 8px; padding-right: 8px; }
.sy-mail-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.sy-mail-title .ox-icon { color: var(--ox-primary); }
.sy-mail-title small { padding: 2px 10px; border-radius: 99px; background: var(--ox-surface-2); color: var(--ox-muted); font-size: 12px; font-weight: 500; }
@media (min-width: 1440px) { html { scroll-behavior: smooth; } }

/* Màn hình chưa đủ rộng cho bảng server: mục lục thành thanh tab dính phía trên */
@media (max-width: 1759px) {
    .sy-set { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .sy-toc { top: 82px; z-index: 12; justify-content: flex-start; flex-direction: row; gap: 4px; padding: 6px; overflow-x: auto; scrollbar-width: none; border-radius: 14px; }
    .sy-toc::-webkit-scrollbar { display: none; }
    .sy-toc__title { display: none; }
    .sy-toc a { flex: none; padding: 5px 12px 5px 5px; font-size: 13px; }
    .sy-set__main > section[id] { scroll-margin-top: 150px; }
}
@media (max-width: 1100px) {
    .sy-toc { top: 66px; }
    .sy-toc a .ox-ic { width: 26px; height: 26px; }
    .sy-set__main > section[id] { scroll-margin-top: 130px; }
}

/* Zalo ZNS: 2 tab, thiết lập dạng thanh bước dọc + 1 bước mỗi lần */
.zl-tabs { align-self: flex-start; }
.zl-setup { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.zl-setup[hidden], .zl-activity[hidden] { display: none; }
.zl-setup > .sy-steps { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.zl-setup > .sy-steps ol { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.zl-setup > .sy-steps ol li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ox-text) !important; }
.zl-setup > .sy-steps ol li a:hover { background: var(--ox-surface-2); }
.zl-setup > .sy-steps ol li.is-current a { background: var(--ox-primary-soft); box-shadow: inset 3px 0 0 var(--ox-primary); }
.zl-setup > .sy-steps ol li span:last-child { display: flex; flex-direction: column; }
.zl-main, .zl-main > .ox-grid-2 { display: contents; }
.zl-main section[id] { display: none; grid-column: 2; }
.zl-main section[id].is-on { display: block; animation: oxpUp .25s ease-out; }
.zl-setup > .sy-steps { grid-column: 1; grid-row: 1 / span 5; }
@media (max-width: 1000px) { .zl-setup { grid-template-columns: minmax(0, 1fr); } .zl-setup > .sy-steps { position: static; grid-row: auto; } .zl-main section[id] { grid-column: 1; } .zl-setup > .sy-steps ol { flex-direction: row; overflow-x: auto; } .zl-setup > .sy-steps ol li a small { display: none; } }
@keyframes oxpUp { from { opacity: 0; transform: translateY(6px); } }
.zl-setup > .sy-steps ol, .zl-setup > .sy-steps ol li { width: 100%; margin: 0; padding: 0; } .zl-setup > .sy-steps ol li::before, .zl-setup > .sy-steps ol li::after { display: none; } .zl-setup > .sy-steps .sy-steps__prog { width: 100%; margin: 0; padding: 0 4px 12px; border-bottom: 1px dashed var(--ox-border); } .zl-setup > .sy-steps .sy-steps__bar { flex: 1; }
