:root {
    --admin-sidebar: #12313a;
    --admin-sidebar-active: #0f766e;
    --admin-bg: #f5f7f9;
    --admin-surface: #ffffff;
    --admin-text: #152632;
    --admin-muted: #667783;
    --admin-line: #dce4e8;
    --admin-accent: #0f766e;
    --admin-accent-hover: #0b5e58;
    --admin-danger: #b42318;
    --admin-warning: #9a6700;
}

body {
    background: var(--admin-bg) !important;
    color: var(--admin-text) !important;
    font-family: "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif !important;
}

.sidebar {
    width: 232px !important;
    background: var(--admin-sidebar) !important;
    box-shadow: none !important;
}

.sidebar-header {
    padding: 22px 18px !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, .12) !important;
}

.sidebar-header h5 {
    margin: 0 0 4px !important;
    font-weight: 700 !important;
}

.sidebar-header .text-muted {
    color: rgba(255, 255, 255, .58) !important;
}

.sidebar-nav {
    padding: 12px 8px;
}

.sidebar .nav-link {
    min-height: 44px;
    margin: 3px 0 !important;
    padding: 10px 12px !important;
    border-radius: 6px !important;
    color: rgba(255, 255, 255, .78) !important;
    transform: none !important;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--admin-sidebar-active) !important;
    color: #fff !important;
}

.sidebar .nav-link i {
    color: currentColor !important;
}

.support-toolbar { display: grid !important; grid-template-columns: minmax(260px, 1fr) 180px auto; gap: 12px; align-items: center; }
.support-list { padding: 18px; display: grid; gap: 14px; }
.feedback-card { border: 1px solid var(--admin-border, #dbe5ec); border-radius: 14px; padding: 18px; background: #fff; }
.feedback-card-head, .feedback-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feedback-card-head > div { min-width: 0; display: grid; gap: 3px; }
.feedback-content { margin: 14px 0; color: #243746; white-space: pre-wrap; word-break: break-word; }
.feedback-reply, .feedback-original { margin-top: 14px; padding: 13px 15px; border-radius: 10px; background: #eefaf7; border-left: 3px solid #0f9387; white-space: pre-wrap; }
.feedback-reply span, .support-meta { display: block; margin-top: 3px; color: #718096; font-size: 12px; font-weight: 400; }
.feedback-chat-modal { overflow: hidden; border: 0; border-radius: 18px; }
.feedback-chat-body { padding: 0; background: #f3f7fa; }
.feedback-chat-messages { height: min(56vh, 560px); min-height: 360px; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.feedback-chat-row { display: flex; width: 100%; }
.feedback-chat-row.is-user { justify-content: flex-start; }
.feedback-chat-row.is-admin { justify-content: flex-end; }
.feedback-chat-bubble { max-width: min(72%, 680px); padding: 11px 14px; border-radius: 16px; box-shadow: 0 2px 8px rgba(18, 52, 71, .06); }
.feedback-chat-row.is-user .feedback-chat-bubble { background: #fff; border: 1px solid #dce6ed; border-bottom-left-radius: 5px; }
.feedback-chat-row.is-admin .feedback-chat-bubble { background: #0f9387; color: #fff; border-bottom-right-radius: 5px; }
.feedback-chat-sender { margin-bottom: 3px; color: #0b7f75; font-size: 12px; font-weight: 700; }
.feedback-chat-row.is-admin .feedback-chat-sender { color: #d9fff9; }
.feedback-chat-content { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.feedback-chat-time { margin-top: 5px; color: #7b8da0; font-size: 11px; }
.feedback-chat-row.is-admin .feedback-chat-time { color: #d4f4f0; text-align: right; }
.feedback-chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 14px 18px; background: #fff; border-top: 1px solid #dce6ed; }
.feedback-chat-compose textarea { resize: none; border-radius: 12px; }
.feedback-chat-compose button { min-width: 116px; height: 44px; }
.feedback-chat-footer .form-select { width: 180px; }
.support-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-pending { background: #fff3d6; color: #9a5b00; }
.status-processing { background: #e8f1ff; color: #175cd3; }
.status-replied { background: #e8f8f2; color: #067647; }
.status-closed { background: #eef1f4; color: #52606d; }
.software-upload-grid { display: grid; grid-template-columns: 1.1fr .8fr .8fr 1.5fr; gap: 16px; align-items: start; }
.software-changelog { grid-column: 1 / 4; }
.software-options { display: flex; flex-direction: column; gap: 10px; padding-top: 30px; }
.upload-progress { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: #0f766e; }
.software-notes td { background: #f8fafc !important; color: #52606d; font-size: 13px; }
@media (max-width: 991px) {
    .support-toolbar, .software-upload-grid { grid-template-columns: 1fr; }
    .software-changelog { grid-column: 1; }
    .software-options { padding-top: 0; }
    .feedback-card-head, .feedback-card-foot { align-items: flex-start; flex-direction: column; }
    .feedback-chat-messages { min-height: 300px; padding: 14px; }
    .feedback-chat-bubble { max-width: 88%; }
    .feedback-chat-compose { grid-template-columns: 1fr; }
    .feedback-chat-footer { align-items: stretch; }
    .feedback-chat-footer .form-select { width: 100%; }
}

.main-content {
    margin-left: 232px !important;
    background: var(--admin-bg) !important;
}

.navbar-top {
    min-height: 64px;
    margin: 0 0 20px !important;
    padding: 10px 24px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--admin-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#pageTitle {
    font-size: 16px;
    font-weight: 700;
}

.container-fluid {
    max-width: 1680px;
    padding: 0 24px 32px !important;
}

.page-title,
#dashboardPage > .mb-4 {
    margin-bottom: 18px !important;
}

.page-title h1,
#dashboardPage h1 {
    margin: 0 0 4px;
    font-size: 28px;
    line-height: 1.3;
    font-weight: 700;
}

.page-title p {
    margin: 0;
    color: var(--admin-muted);
}

.stats-card,
.content-card,
.card,
.table-responsive {
    border: 1px solid var(--admin-line) !important;
    border-radius: 8px !important;
    background: var(--admin-surface) !important;
    box-shadow: none !important;
}

.stats-card {
    min-height: 128px;
    padding: 18px !important;
    transform: none !important;
}

.stats-card:hover {
    transform: none !important;
}

.stats-card .icon {
    width: 42px !important;
    height: 42px !important;
    margin-bottom: 12px !important;
    border-radius: 7px !important;
    background: #e6f4f1 !important;
    color: var(--admin-accent) !important;
    font-size: 19px !important;
}

.stats-card .number {
    font-size: 27px !important;
    line-height: 1.15;
    color: var(--admin-text) !important;
}

.content-card .card-header {
    min-height: 54px;
    padding: 12px 16px;
    background: #fbfcfd;
    border-bottom: 1px solid var(--admin-line);
}

.content-card .card-body {
    padding: 16px;
}

.btn,
.form-control,
.form-select {
    border-radius: 6px !important;
}

.btn-primary,
.btn-success {
    background: var(--admin-accent) !important;
    border-color: var(--admin-accent) !important;
}

.btn-primary:hover,
.btn-success:hover {
    background: var(--admin-accent-hover) !important;
    border-color: var(--admin-accent-hover) !important;
}

.btn-outline-primary,
.btn-outline-success {
    color: var(--admin-accent) !important;
    border-color: #79b9b3 !important;
}

.btn-outline-primary:hover,
.btn-outline-success:hover {
    color: #fff !important;
    background: var(--admin-accent) !important;
    border-color: var(--admin-accent) !important;
}

.account-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.account-toolbar .input-group { flex: 1 1 260px; }
.account-toolbar .form-select { flex: 0 0 150px; width: 150px; }

.account-summary .stats-card {
    min-height: 104px;
    display: grid;
    grid-template-columns: 42px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
}

.account-summary .stats-card .icon {
    grid-row: 1 / 3;
    margin: 0 !important;
}

.account-summary .stats-card .number {
    align-self: end;
}

.account-summary .stats-card .text-muted {
    align-self: start;
}

.account-table {
    min-width: 980px;
    margin: 0;
}

.account-table th {
    padding: 11px 12px !important;
    border-bottom: 1px solid var(--admin-line) !important;
    color: #51616c !important;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.account-table td {
    padding: 12px !important;
    border-color: #edf1f3 !important;
    color: var(--admin-text);
    vertical-align: middle;
}

.account-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.account-avatar {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eaf1f4;
    color: #37515e;
}

.account-name {
    font-weight: 700;
}

.account-meta {
    max-width: 220px;
    overflow: hidden;
    color: var(--admin-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    white-space: nowrap;
}

.account-device-row > td { background: #f8fbfc !important; padding: 14px 18px !important; }

.badge-role,
.badge-state {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin { background: #fff4d6; border-color: #f1d486; color: #765000; }
.badge-user { background: #eaf1f4; border-color: #d5e0e5; color: #37515e; }
.badge-active { background: #e8f6ee; border-color: #b9e0c8; color: #176b3a; }
.badge-blocked { background: #fff0ee; border-color: #f0c2bc; color: var(--admin-danger); }
.badge-pending { background: #fff6df; border-color: #ead39b; color: var(--admin-warning); }

.admin-empty,
.admin-error,
.admin-loading {
    padding: 48px 20px;
    text-align: center;
    color: var(--admin-muted);
}

.admin-error {
    color: var(--admin-danger);
}

.admin-empty i,
.admin-error i,
.admin-loading i {
    display: block;
    margin-bottom: 10px;
    font-size: 30px;
}

.device-overview-item {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px 130px 170px;
    gap: 16px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid #edf1f3;
}

.device-overview-item:last-child {
    border-bottom: 0;
}

.device-overview-name {
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-overview-meta {
    color: var(--admin-muted);
    font-size: 12px;
}

.modal-content {
    border: 1px solid var(--admin-line) !important;
    border-radius: 8px !important;
    box-shadow: 0 20px 60px rgba(21, 38, 50, .18) !important;
}

@media (max-width: 991px) {
    .main-content { margin-left: 0 !important; }
    .navbar-top { padding-left: 64px !important; }
    .container-fluid { padding: 0 16px 24px !important; }
    .account-toolbar .input-group { flex-basis: 100%; }
    .device-overview-item { grid-template-columns: 1fr 120px; }
    .device-overview-item > :nth-child(3),
    .device-overview-item > :nth-child(4) { text-align: left !important; }
}

.software-share-panel { display: grid; grid-template-columns: minmax(0, 1fr) 172px; align-items: center; gap: 28px; }
.software-share-panel img { max-width: 100%; background: #fff; }
@media (max-width: 576px) {
    .software-share-panel { grid-template-columns: 1fr; gap: 20px; }
    .page-title h1,
    #dashboardPage h1 { font-size: 22px !important; }
    .account-toolbar .form-select { flex: 1 1 100%; width: 100%; }
    .account-toolbar .btn { flex: 1 1 auto; }
    .account-summary .col-6 { padding-left: 5px; padding-right: 5px; }
    .account-summary .stats-card { min-height: 96px; padding: 13px !important; }
    .device-overview-item { grid-template-columns: 1fr; gap: 4px; }
}
