/* ==========================================================================
   设置中心 · 人员管理
   仅管理员可打开（入口按钮由 app.js 按角色控制显隐）
   色系跟随站点暖石主题
   ========================================================================== */

/* ---------- 遮罩 ---------- */
.st-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 41, 38, 0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
    z-index: 1200;
}
.st-overlay.show { opacity: 1; visibility: visible; }
.st-overlay-2 { z-index: 1260; background: rgba(45, 41, 38, 0.34); }

/* ---------- 主模态 ---------- */
.st-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(940px, calc(100vw - 64px));
    height: min(640px, calc(100vh - 80px));
    background: #FFFDFA;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(45, 41, 38, 0.24), 0 2px 8px rgba(45, 41, 38, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms cubic-bezier(.2,.8,.3,1), transform 220ms cubic-bezier(.2,.8,.3,1), visibility 220ms;
    z-index: 1210;
    font-family: var(--font-sans, 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif);
}
.st-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ---------- 头部 ---------- */
.st-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #EFE8E0;
    background: linear-gradient(180deg, #FFFDFA 0%, #FDF8F2 100%);
    flex-shrink: 0;
}
.st-head-title { display: flex; align-items: center; gap: 12px; }
.st-head-ico {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(194, 133, 91, 0.12);
    color: #C2855B;
    flex-shrink: 0;
}
.st-head h2 { font-size: 16px; font-weight: 600; color: #2D2926; margin: 0; letter-spacing: .3px; }
.st-head p { font-size: 12px; color: #9A9088; margin: 3px 0 0; }
.st-x {
    width: 30px; height: 30px; border-radius: 8px; border: none;
    background: transparent; color: #9A9088; font-size: 20px; line-height: 1;
    cursor: pointer; transition: all 180ms ease;
}
.st-x:hover { background: rgba(196, 114, 110, 0.08); color: #C4726E; }

/* ---------- 主体：左导航 + 右内容 ---------- */
.st-body { flex: 1; display: flex; min-height: 0; }
.st-side {
    width: 186px;
    flex-shrink: 0;
    border-right: 1px solid #EFE8E0;
    background: #FDFAF6;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.st-nav {
    display: flex; align-items: center; gap: 9px;
    width: 100%;
    padding: 10px 12px;
    border: none; border-radius: 9px;
    background: transparent;
    color: #6E645A;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 180ms ease;
}
.st-nav:hover { background: rgba(194, 133, 91, 0.08); color: #2D2926; }
.st-nav.active {
    background: rgba(194, 133, 91, 0.13);
    color: #A96F45;
    font-weight: 600;
}
.st-nav svg { flex-shrink: 0; }

.st-main { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 24px; }
.st-panel { display: none; }
.st-panel.active { display: block; }
.st-panel-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 16px;
}
.st-panel-head h3 { font-size: 15px; font-weight: 600; color: #2D2926; margin: 0; }
.st-panel-head p { font-size: 12px; color: #9A9088; margin: 5px 0 0; line-height: 1.5; }

/* ---------- 按钮 ---------- */
.st-btn {
    font-family: inherit;
    font-size: 13px;
    color: #6E645A;
    background: #FFFFFF;
    border: 1px solid #E5DDD4;
    border-radius: 9px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 180ms ease;
    display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap;
}
.st-btn:hover { border-color: #D6C9BA; background: #FDFAF6; color: #2D2926; }
.st-btn-primary {
    background: linear-gradient(135deg, #C98F62 0%, #B0734A 100%);
    border-color: transparent;
    color: #FFFFFF;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(176, 115, 74, 0.25);
}
.st-btn-primary:hover {
    background: linear-gradient(135deg, #C98F62 0%, #A2663F 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(176, 115, 74, 0.32);
}
.st-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 人员表格 ---------- */
.st-table-wrap {
    border: 1px solid #EFE8E0;
    border-radius: 12px;
    overflow: hidden;
    background: #FFFFFF;
}
.st-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-table thead th {
    background: #FBF7F1;
    color: #857A70;
    font-weight: 500;
    font-size: 12px;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #EFE8E0;
    white-space: nowrap;
}
.st-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #F4EFE8;
    color: #2D2926;
    vertical-align: middle;
}
.st-table tbody tr:last-child td { border-bottom: none; }
.st-table tbody tr:hover { background: #FDFAF6; }
.st-table tbody tr.off { opacity: .58; }
.st-table .st-time { color: #9A9088; font-size: 12px; white-space: nowrap; }
/* 用户名(1) / 状态(3) 列禁止折行（否则「启用」「当前登录」会被挤成两行） */
.st-table tbody td:nth-child(1),
.st-table tbody td:nth-child(3) { white-space: nowrap; }
.st-empty { text-align: center; color: #A79E95; padding: 40px 0 !important; font-size: 13px; }

.st-self {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(194, 133, 91, 0.14);
    color: #A96F45;
    font-weight: 500;
    vertical-align: 1px;
}

/* 角色 */
.st-role {
    display: inline-block;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 6px;
    background: #F3EFE9;
    color: #6E645A;
    white-space: nowrap;
}
.st-role-admin {
    background: rgba(194, 133, 91, 0.14);
    color: #A96F45;
    font-weight: 500;
}

/* 权限标签 */
.st-perm-cell { max-width: 260px; }
.st-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 7px;
    margin: 2px 4px 2px 0;
    border-radius: 5px;
    background: #F2F6F2;
    color: #5F7A61;
    white-space: nowrap;
}
.st-tag-all { background: rgba(194, 133, 91, 0.12); color: #A96F45; }
.st-tag-none { background: #F6F1F1; color: #B08A88; }

/* 状态 */
.st-dot {
    display: inline-block;
    width: 6px; height: 6px; border-radius: 50%;
    margin-right: 6px; vertical-align: 1px;
}
.st-dot.on { background: #7BA37F; }
.st-dot.off { background: #BDB4AB; }

/* 操作链接 */
.st-ops { white-space: nowrap; }
.st-link {
    background: none; border: none; padding: 2px 6px;
    font-family: inherit; font-size: 12px;
    color: #B0734A; cursor: pointer; border-radius: 5px;
    transition: all 160ms ease;
}
.st-link:hover { background: rgba(176, 115, 74, 0.09); }
.st-link.danger { color: #C4726E; }
.st-link.danger:hover { background: rgba(196, 114, 110, 0.1); }

/* ---------- 表单模态 ---------- */
.st-modal-form {
    width: min(520px, calc(100vw - 48px));
    height: auto;
    max-height: calc(100vh - 72px);
    z-index: 1270;
}
.st-form-body {
    padding: 18px 22px 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.st-field { margin-bottom: 15px; }
.st-field > label {
    display: block;
    font-size: 12px;
    color: #6E645A;
    margin-bottom: 6px;
    font-weight: 500;
}
.st-field > label i {
    font-style: normal;
    font-weight: 400;
    color: #A79E95;
    margin-left: 6px;
}
.st-field input[type="text"],
.st-field input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    color: #2D2926;
    background: #FDFBF8;
    border: 1px solid #E5DDD4;
    border-radius: 9px;
    padding: 9px 12px;
    outline: none;
    transition: all 180ms ease;
}
.st-field input:focus {
    border-color: #C98F62;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(194, 133, 91, 0.12);
}
.st-field input::placeholder { color: #BDB4AB; }

/* 角色分段控件 */
.st-seg {
    display: inline-flex;
    background: #F5F0EA;
    border-radius: 9px;
    padding: 3px;
    gap: 3px;
}
.st-seg button {
    font-family: inherit;
    font-size: 13px;
    color: #6E645A;
    background: transparent;
    border: none;
    border-radius: 7px;
    padding: 7px 18px;
    cursor: pointer;
    transition: all 180ms ease;
}
.st-seg button:hover { color: #2D2926; }
.st-seg button.active {
    background: #FFFFFF;
    color: #A96F45;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(45, 41, 38, 0.1);
}

/* 权限勾选 */
.st-perms { display: flex; flex-direction: column; gap: 7px; }
.st-perm {
    display: flex; align-items: center; gap: 9px;
    font-size: 13px; color: #2D2926;
    padding: 9px 12px;
    border: 1px solid #EFE8E0;
    border-radius: 9px;
    background: #FDFBF8;
    cursor: pointer;
    transition: all 160ms ease;
}
.st-perm:hover { border-color: #DCCFC0; background: #FBF6F0; }
.st-perm input { width: 15px; height: 15px; accent-color: #B0734A; cursor: pointer; margin: 0; }
.st-perm.locked { opacity: .62; cursor: not-allowed; background: #F8F5F0; }
.st-perm.locked input { cursor: not-allowed; }

/* 开关 */
.st-field-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 0 2px;
}
.st-field-row > label { margin-bottom: 0; font-size: 13px; color: #2D2926; }
.st-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.st-switch input { opacity: 0; width: 0; height: 0; }
.st-switch span {
    position: absolute; inset: 0;
    background: #DCD4CB; border-radius: 11px;
    cursor: pointer; transition: background 200ms ease;
}
.st-switch span::before {
    content: ''; position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #FFF; border-radius: 50%;
    transition: transform 200ms ease;
    box-shadow: 0 1px 3px rgba(45,41,38,.2);
}
.st-switch input:checked + span { background: #B0734A; }
.st-switch input:checked + span::before { transform: translateX(18px); }

.st-form-err {
    font-size: 12px;
    color: #C4726E;
    min-height: 17px;
    padding-bottom: 4px;
}

/* 底部按钮 */
.st-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #EFE8E0;
    background: #FDFAF6;
    flex-shrink: 0;
}

/* ---------- 首页无权限提示 ---------- */
.home-noperm {
    margin-top: 18px;
    padding: 12px 20px;
    border-radius: 12px;
    background: rgba(194, 133, 91, 0.08);
    border: 1px dashed rgba(194, 133, 91, 0.35);
    color: #A96F45;
    font-size: 13px;
    text-align: center;
}

/* ---------- 顶栏设置按钮 ---------- */
.topbar .settings-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #6E645A;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 180ms ease;
}
.topbar .settings-btn:hover {
    background: rgba(194, 133, 91, 0.12);
    color: #B0734A;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
    .st-side { width: 132px; padding: 12px 8px; }
    .st-nav { font-size: 12px; padding: 9px 9px; }
    .st-main { padding: 16px 14px; }
    .st-modal { width: calc(100vw - 24px); height: calc(100vh - 40px); }
}
