/* ==========================================================================
   美甲会员管理系统 —— 后台样式（自带样式，不依赖任何 CDN）
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    font-size: 14px;
    color: #2b2b33;
    background: #f6f7fb;
    line-height: 1.6;
}

a {
    color: #d9558a;
    text-decoration: none;
}

a:hover {
    opacity: 0.85;
}

/* ---------- 布局 ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 224px;
    flex: 0 0 224px;
    background: #241f2b;
    color: #cfc6d4;
    padding: 20px 0 40px;
    overflow-y: auto;
}

.sidebar .logo {
    padding: 0 20px 18px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
    border-bottom: 1px solid #362f3f;
}

.sidebar .logo small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #9a8fa5;
    margin-top: 4px;
}

.menu {
    list-style: none;
    padding: 12px 0;
}

.menu .menu-group {
    padding: 12px 20px 6px;
    font-size: 12px;
    color: #7d7189;
    letter-spacing: 1px;
}

.menu a {
    display: block;
    padding: 10px 20px;
    color: #cfc6d4;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.menu a:hover {
    background: #2e2736;
    color: #ffffff;
}

.menu a.active {
    background: #2e2736;
    color: #ffffff!important;
    border-left-color: #e07aa6;
    font-weight: 600;
}

.menu > li > a {
    padding-left: 20px;
}

.menu .sub a {
    padding-left: 36px;
    font-size: 13px;
    color: #b9aec4;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 58px;
    background: #ffffff;
    border-bottom: 1px solid #ebe9f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
}

.crumb {
    font-size: 14px;
    color: #6f6169;
}

.crumb span + span::before {
    content: " / ";
    color: #c9c2ce;
    margin: 0 6px;
}

.crumb span:last-child {
    color: #2b2b33;
    font-weight: 600;
}

.user-box {
    font-size: 14px;
    color: #6f6169;
}

.user-box b {
    color: #2b2b33;
}

.user-box a {
    margin-left: 16px;
}

.content {
    padding: 22px 26px 48px;
    flex: 1;
}

/* ---------- 页头 ---------- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-head h1 {
    font-size: 19px;
}

.page-head .desc {
    font-size: 13px;
    color: #8d7d85;
    margin-top: 2px;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- 统计卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(40, 30, 60, 0.05);
}

.stat-card .label {
    font-size: 13px;
    color: #8d7d85;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: #2b2b33;
}

.stat-card .value small {
    font-size: 13px;
    font-weight: 400;
    color: #8d7d85;
    margin-left: 4px;
}

.stat-card .sub {
    font-size: 12px;
    color: #a2949b;
    margin-top: 6px;
}

/* ---------- 面板 ---------- */
.panel {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 4px 16px rgba(40, 30, 60, 0.05);
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0eef5;
    gap: 12px;
    flex-wrap: wrap;
}

.panel-head h3 {
    font-size: 16px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

/* ---------- 筛选区 ---------- */
.filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e3e0ea;
    border-radius: 8px;
    font-size: 14px;
    background: #fdfdff;
    outline: none;
    color: #2b2b33;
}

.filters input:focus,
.filters select:focus {
    border-color: #e07aa6;
}

.filters input[type="text"] {
    width: 200px;
}

/* ---------- 表格 ---------- */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid #f2f0f6;
    white-space: nowrap;
}

.table th {
    background: #faf9fc;
    color: #6f6169;
    font-weight: 600;
    font-size: 13px;
}

.table tbody tr:hover {
    background: #fdf9fb;
}

.table td.wrap {
    white-space: normal;
    min-width: 180px;
}

.table .actions a,
.table .actions button {
    margin-right: 10px;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block;
    height: 36px;
    line-height: 34px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid #e3e0ea;
    background: #ffffff;
    color: #4c4450;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn:hover {
    border-color: #e07aa6;
    color: #d9558a;
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #f089b0, #d9558a);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

.btn-primary:hover {
    color: #ffffff;
    opacity: 0.9;
}

.btn-danger {
    color: #d9534f;
    border-color: #f0cfcd;
}

.btn-danger:hover {
    border-color: #d9534f;
    color: #c9302c;
}

.btn-sm {
    height: 28px;
    line-height: 26px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    font-size: 12px;
    border-radius: 10px;
    background: #f2f0f6;
    color: #6f6169;
    line-height: 18px;
}

.badge-green {
    background: #e8f7ef;
    color: #1a9c63;
}

.badge-red {
    background: #fdeaea;
    color: #d9534f;
}

.badge-orange {
    background: #fff4e5;
    color: #d98613;
}

.badge-blue {
    background: #eaf2fe;
    color: #4a7fd4;
}

.badge-purple {
    background: #f4ecfd;
    color: #8b5cf6;
}

/* ---------- 表单 ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px 20px;
}

.form-item {
    display: flex;
    flex-direction: column;
}

.form-item.full {
    grid-column: 1 / -1;
}

.form-item label {
    font-size: 13px;
    color: #6f6169;
    margin-bottom: 6px;
}

.form-item label .req {
    color: #d9534f;
    margin-left: 2px;
}

.form-item input,
.form-item select,
.form-item textarea {
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e3e0ea;
    border-radius: 8px;
    font-size: 14px;
    background: #fdfdff;
    outline: none;
    color: #2b2b33;
}

.form-item textarea {
    height: auto;
    min-height: 84px;
    padding: 10px 12px;
    resize: vertical;
}

.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
    border-color: #e07aa6;
}

.form-item .tip {
    font-size: 12px;
    color: #a2949b;
    margin-top: 5px;
}

.form-item .static {
    height: 38px;
    line-height: 38px;
    color: #4c4450;
}

.form-actions {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #f0eef5;
    display: flex;
    gap: 10px;
}

.form-alert {
    display: none;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    background: #fdeaea;
    color: #c9302c;
}

.form-alert.show {
    display: block;
}

/* ---------- 分页 ---------- */
.pagination {
    list-style: none;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination li {
    display: inline-block;
}

.pagination li span,
.pagination li a {
    display: inline-block;
    min-width: 32px;
    height: 32px;
    line-height: 30px;
    padding: 0 8px;
    text-align: center;
    border: 1px solid #e3e0ea;
    border-radius: 8px;
    background: #ffffff;
    color: #4c4450;
    font-size: 13px;
}

.pagination li.active span {
    background: linear-gradient(135deg, #f089b0, #d9558a);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

.pagination li.disabled span {
    color: #c9c2ce;
    background: #faf9fc;
}

.total-tip {
    font-size: 13px;
    color: #8d7d85;
}

/* ---------- 提示 ---------- */
.toast {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%) translateY(-24px);
    min-width: 220px;
    max-width: 80vw;
    padding: 12px 20px;
    border-radius: 10px;
    background: #2b2b33;
    color: #ffffff;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #1a9c63;
}

.toast.error {
    background: #d9534f;
}

/* ---------- 空状态 ---------- */
.empty {
    padding: 40px 20px;
    text-align: center;
    color: #a2949b;
    font-size: 14px;
}

.empty .big {
    font-size: 34px;
    margin-bottom: 8px;
    color: #e0d8e4;
}

/* ---------- 详情页 ---------- */
.info-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px 22px;
    font-size: 14px;
}

.info-list .row {
    display: flex;
    gap: 8px;
}

.info-list .row .k {
    color: #8d7d85;
    flex: 0 0 92px;
}

.info-list .row .v {
    color: #2b2b33;
    word-break: break-all;
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid #f0eef5;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tabs a {
    padding: 9px 16px;
    font-size: 14px;
    color: #6f6169;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tabs a.active {
    color: #d9558a;
    border-bottom-color: #e07aa6;
    font-weight: 600;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ---------- 权限规则树 ---------- */
.rule-box {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
}

.rule-node {
    padding: 8px 0;
    border-bottom: 1px dashed #f0eef5;
}

.rule-node:last-child {
    border-bottom: none;
}

.rule-head {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.rule-children {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 6px 0 2px 22px;
}

.rule-children label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #6f6169;
    cursor: pointer;
}

/* ---------- 工具类 ---------- */
.money {
    font-weight: 600;
    color: #d9558a;
}

.money-neg {
    font-weight: 600;
    color: #1a9c63;
}

.muted {
    color: #a2949b;
}

.text-danger {
    color: #d9534f;
}

.text-success {
    color: #1a9c63;
}

.mt-10 {
    margin-top: 10px;
}

.mt-16 {
    margin-top: 16px;
}

.nowrap {
    white-space: nowrap;
}

.level-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 12px;
    background: #f4ecfd;
    color: #8b5cf6;
}

/* ---------- 窄屏适配 ---------- */
@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex: none;
        padding-bottom: 12px;
    }

    .content {
        padding: 16px 14px 40px;
    }

    .topbar {
        padding: 0 14px;
    }
}

/* ---------- 预约日历 ---------- */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 13px;
    color: #6f6169;
    margin-bottom: 12px;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.cal-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    table-layout: fixed;
}

.cal-table th {
    background: #faf9fc;
    color: #6f6169;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 6px;
    border: 1px solid #f0eef5;
}

.cal-table td.cal-cell {
    border: 1px solid #f0eef5;
    vertical-align: top;
    padding: 6px;
    height: 112px;
}

.cal-cell.cal-out {
    background: #fbfafc;
}

.cal-cell.cal-out .cal-num {
    color: #c9c2ce;
}

.cal-cell.cal-today {
    background: #fff8fb;
    box-shadow: inset 0 0 0 2px #f7dde8;
}

.cal-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.cal-num {
    font-size: 14px;
    font-weight: 600;
    color: #4c4450;
}

.cal-cell.cal-today .cal-num {
    color: #d9558a;
}

.cal-count {
    font-size: 11px;
    color: #8d7d85;
    background: #f2f0f6;
    border-radius: 9px;
    padding: 0 6px;
    line-height: 16px;
}

.cal-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 84px;
    overflow-y: auto;
}

.cal-item {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    padding: 3px 6px;
    border-radius: 6px;
    border-left: 3px solid #c9c2ce;
    background: #f7f6f9;
    color: #4c4450;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.cal-item:hover {
    opacity: 0.85;
}

.cal-time {
    font-weight: 600;
    margin-right: 4px;
}

.cal-service {
    color: #8d7d85;
    margin-left: 4px;
}

/* 预约状态配色 */
.cal-st-0 { border-left-color: #d98613; background: #fff7ea; }
.cal-dot.cal-st-0 { background: #d98613; }
.cal-st-1 { border-left-color: #4a7fd4; background: #eef4fe; }
.cal-dot.cal-st-1 { background: #4a7fd4; }
.cal-st-2 { border-left-color: #8b5cf6; background: #f5f0fe; }
.cal-dot.cal-st-2 { background: #8b5cf6; }
.cal-st-3 { border-left-color: #1a9c63; background: #ecf9f2; }
.cal-dot.cal-st-3 { background: #1a9c63; }
.cal-st-4 { border-left-color: #a2949b; background: #f5f4f6; color: #8d7d85; }
.cal-dot.cal-st-4 { background: #a2949b; }
.cal-st-5 { border-left-color: #d9534f; background: #fdeeed; }
.cal-dot.cal-st-5 { background: #d9534f; }
/* ---------- 在线客服 ---------- */
.chat-app {
    display: flex;
    flex-direction: column;
}

.chat-layout {
    display: flex;
    border: 1px solid #f0eef5;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.chat-side {
    width: 280px;
    flex: 0 0 280px;
    border-right: 1px solid #f0eef5;
    display: flex;
    flex-direction: column;
    background: #fcfbfd;
}

.chat-side-head {
    padding: 10px;
    border-bottom: 1px solid #f0eef5;
}

.chat-side-head .filters {
    flex-wrap: wrap;
    gap: 6px;
}

.chat-side-head input[type="text"] {
    width: 100%;
}

.chat-sessions {
    flex: 1;
    overflow-y: auto;
    max-height: 560px;
}

.chat-session {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid #f6f4f8;
    color: #4c4450;
}

.chat-session:hover {
    background: #fdf1f6;
    opacity: 1;
}

.chat-session.active {
    background: #fdf1f6;
    box-shadow: inset 3px 0 0 #d9558a;
}

.chat-session .row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

.chat-session .row1 .time {
    font-size: 11px;
    color: #a2949b;
}

.chat-session .row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: #8d7d85;
}

.chat-session .row2 .msg {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0eef5;
    flex-wrap: wrap;
}

.chat-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-status {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 10px;
    background: #f2f0f6;
    color: #6f6169;
}

.chat-status.on {
    background: #ecf9f2;
    color: #1a9c63;
}

.chat-status.off {
    background: #f5f4f6;
    color: #8d7d85;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #faf9fc;
    min-height: 320px;
    max-height: 460px;
}

.chat-empty {
    text-align: center;
    color: #a2949b;
    font-size: 13px;
    padding: 40px 0;
}

.chat-bubble {
    max-width: 76%;
    margin-bottom: 12px;
}

.chat-bubble .meta {
    font-size: 11px;
    color: #a2949b;
    margin-bottom: 4px;
}

.chat-bubble .text {
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble.left {
    margin-right: auto;
}

.chat-bubble.left .text {
    background: #ffffff;
    border: 1px solid #f0eef5;
    border-top-left-radius: 3px;
}

.chat-bubble.right {
    margin-left: auto;
    text-align: right;
}

.chat-bubble.right .text {
    background: linear-gradient(135deg, #f089b0, #d9558a);
    color: #ffffff;
    border-top-right-radius: 3px;
    text-align: left;
}

.chat-bubble.system {
    max-width: 100%;
    text-align: center;
    margin: 10px 0;
}

.chat-bubble.system .meta {
    display: none;
}

.chat-bubble.system .text {
    display: inline-block;
    background: #f2f0f6;
    color: #8d7d85;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
}

.chat-input {
    border-top: 1px solid #f0eef5;
    padding: 12px 16px;
    background: #ffffff;
}

.chat-input textarea {
    width: 100%;
    min-height: 62px;
    border: 1px solid #eee6ec;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #f0a9c6;
    box-shadow: 0 0 0 3px rgba(240, 137, 176, 0.14);
}

.chat-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.chat-quick {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-panel {
    padding: 0;
    overflow: hidden;
}

.chat-panel .chat-list {
    max-height: 420px;
}

.chat-online {
    font-size: 13px;
    color: #8d7d85;
}

.chat-online.on {
    color: #1a9c63;
}

.chat-online.off {
    color: #d98613;
}

.chat-online::before {
    content: '●';
    margin-right: 5px;
    font-size: 10px;
    vertical-align: 1px;
}

.menu-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: #e04b6d;
    color: #ffffff;
    font-size: 11px;
    text-align: center;
    vertical-align: 1px;
}

@media (max-width: 900px) {
    .chat-layout {
        flex-direction: column;
    }

    .chat-side {
        width: 100%;
        flex: none;
        border-right: none;
        border-bottom: 1px solid #f0eef5;
    }

    .chat-sessions {
        max-height: 200px;
    }
}
/* ---------- 图片上传（系统设置） ---------- */
.upload-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    padding: 10px;
    border: 1px dashed #e6dfe9;
    border-radius: 10px;
    background: #fbfafc;
}

.upload-preview img {
    display: block;
    max-width: 100%;
    max-height: 84px;
    object-fit: contain;
}

.upload-preview img.hide {
    display: none;
}

.upload-placeholder {
    font-size: 13px;
    color: #a2949b;
}

.upload-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.upload-actions label.btn {
    display: inline-block;
}
/* ---------- 验证码 ---------- */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-row input {
    flex: 1;
    min-width: 0;
}

.captcha-row img {
    height: 42px;
    width: auto;
    border: 1px solid #eee6ec;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    flex: 0 0 auto;
}

/* ---------- 密码强度提示 ---------- */
.pw-box {
    display: block;
}

.pw-policy {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.pw-policy li {
    position: relative;
    padding-left: 15px;
    font-size: 12px;
    color: #a2949b;
    line-height: 1.8;
}

.pw-policy li::before {
    content: '○';
    position: absolute;
    left: 0;
    font-size: 11px;
}

.pw-policy li.ok {
    color: #1a9c63;
}

.pw-policy li.ok::before {
    content: '●';
}