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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #121212;
    color: #e8e8e8;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

.login-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
}

.login-box {
    width: 420px;
    padding: 48px 40px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid #2a2a2a;
}

.login-logo {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: #14b8a6;
    margin-bottom: 44px;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #a0a0a0;
    font-size: 14px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: #252525;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    background: #2a2a2a;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #14b8a6;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #0d9488;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid #404040;
    color: #d0d0d0;
}

.btn-outline:hover:not(:disabled) {
    border-color: #14b8a6;
    color: #14b8a6;
    background: rgba(20, 184, 166, 0.1);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-warning {
    background: #f59e0b;
    color: #000;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

.btn.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

.layout {
    display: grid;
    grid-template-columns: 140px 1fr;
    grid-template-rows: 64px 1fr;
    height: 100vh;
    width: 100vw;
}

.header {
    grid-column: 1 / -1;
    background: #0f0f0f;
    border-bottom: 1px solid #252525;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.header-logo {
    font-size: 20px;
    font-weight: 700;
    color: #14b8a6;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo .logo-img {
    height: 32px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.header-user .user-name {
    color: #14b8a6;
    font-weight: 600;
    padding: 6px 14px;
    background: rgba(20, 184, 166, 0.12);
    border-radius: 6px;
    font-size: 13px;
}

.header-user a {
    color: #909090;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 13px;
}

.header-user a:hover {
    color: #14b8a6;
}

.header-user .divider {
    width: 1px;
    height: 18px;
    background: #303030;
}

.sidebar {
    background: #0f0f0f;
    border-right: 1px solid #252525;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 8px);
    margin: 0 4px;
    padding: 17px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #888888;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.sidebar-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-tab.active {
    background: #14b8a6;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.main-content {
    padding: 28px;
    overflow-y: auto;
    background: #121212;
}

.sub-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    background: #1a1a1a;
    border-radius: 10px;
    padding: 6px;
    border: 1px solid #2a2a2a;
    width: fit-content;
}

.sub-tab {
    padding: 12px 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #808080;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab:hover {
    color: #ffffff;
    background: #252525;
}

.sub-tab.active {
    background: #14b8a6;
    color: #fff;
    font-weight: 600;
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.cat-tab {
    padding: 8px 18px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    color: #808080;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-tab:hover {
    color: #14b8a6;
    border-color: #14b8a6;
}

.cat-tab.active {
    background: #14b8a6;
    border-color: #14b8a6;
    color: #fff;
}

/* ========== 素材卡片网格 ========== */
.mat-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #222;
}

.mat-page-subtitle {
    font-size: 13px;
    color: #14b8a6;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.mat-page-title {
    font-size: 30px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
}

.mat-page-search .search-input {
    width: 280px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
}

.mat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mat-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.mat-card {
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    transition: all 0.25s ease;
    cursor: pointer;
}

.mat-card:hover {
    transform: translateY(-4px);
    border-color: #14b8a6;
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.15);
}

.mat-card:hover .mat-card-actions {
    opacity: 1;
}

/* 图片卡片（资产库/风格库） */
.mat-card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: #0f0f0f;
    overflow: hidden;
}

.mat-card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mat-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 36px;
}

/* 文字区域 */
.mat-card-body {
    padding: 14px 16px 14px;
    display: flex;
    flex-direction: column;
}

/* 纯文字卡片（指令库）需要避让右上角角标 */
.mat-card-body.mat-card-body-text {
    padding: 28px 18px 16px;
    min-height: 160px;
}

.mat-card-image-wrap + .mat-card-body {
    min-height: auto;
}

.mat-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mat-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.mat-badge-official {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #14b8a6;
    border: 1px solid rgba(20, 184, 166, 0.5);
    background: rgba(20, 184, 166, 0.08);
    flex-shrink: 0;
    line-height: 1.4;
}

/* 右上角分类角标 */
.mat-corner-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border-bottom-left-radius: 10px;
    z-index: 2;
}

.mat-corner-badge.cate-fenjing { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.mat-corner-badge.cate-zichan  { background: linear-gradient(135deg, #ec4899, #db2777); }
.mat-corner-badge.cate-miaoshu { background: linear-gradient(135deg, #22c55e, #16a34a); }
.mat-corner-badge.cate-juese   { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.mat-corner-badge.cate-zhangjie{ background: linear-gradient(135deg, #f59e0b, #d97706); }
.mat-corner-badge.cate-changjing{background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.mat-corner-badge.cate-daoju   { background: linear-gradient(135deg, #eab308, #ca8a04); }
.mat-corner-badge.cate-style   { background: linear-gradient(135deg, #14b8a6, #0d9488); }

.mat-card-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* autoprefixer: off */
    -webkit-box-orient: vertical;
    /* autoprefixer: on */
    overflow: hidden;
    flex: 1;
    margin-bottom: 10px;
}

.mat-card-image-wrap + .mat-card-body .mat-card-desc {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-bottom: 8px;
}

.mat-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: auto;
}

.mat-card-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.mat-card-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.mat-card-status.on::before { background: #22c55e; }
.mat-card-status.off::before { background: #666; }

/* hover操作遮罩 */
.mat-card-actions {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 3;
    border-radius: 14px;
}

.mat-card-actions .btn {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.mat-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 14px;
}

.mat-pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.mat-pagination-wrap .pagination {
    margin-top: 0;
    justify-content: center;
}

@media (max-width: 1400px) {
    .mat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
    .mat-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
    background: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 28px;
    border-bottom: 1px solid #252525;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
}

.card-body {
    padding: 24px 28px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input {
    width: 300px;
    padding: 11px 14px 11px 40px;
    background: #252525;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    background: #2a2a2a;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #252525;
    font-size: 14px;
}

.data-table th {
    color: #909090;
    font-weight: 600;
    font-size: 13px;
    background: #151515;
}

.data-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.data-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.data-table tr:hover td {
    background: #202020;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.tag-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.tag-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.tag-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tag-primary {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.tag-muted {
    background: rgba(128, 128, 128, 0.15);
    color: #808080;
}

.tag-secondary {
    background: rgba(176, 176, 176, 0.1);
    color: #b0b0b0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 28px;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background: #252525;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #d0d0d0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.pagination button:hover:not(:disabled) {
    border-color: #14b8a6;
    color: #14b8a6;
    background: rgba(20, 184, 166, 0.1);
}

.pagination button.active {
    background: #14b8a6;
    border-color: #14b8a6;
    color: #fff;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    width: 560px;
    max-width: 92vw;
    max-height: 90vh;
    background: #121212;
    border-radius: 14px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.modal-header {
    padding: 22px 28px;
    border-bottom: 1px solid #252525;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f0f0f;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #808080;
    font-size: 22px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #252525;
    color: #ffffff;
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 150px);
    overflow-y: auto;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid #252525;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #0f0f0f;
}

.form-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row label {
    color: #b0b0b0;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.form-row .form-input {
    width: 100%;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 32px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    white-space: nowrap;
}

.toast.success {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.toast.error {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.toast.warning {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

@keyframes toastIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333333;
    border: 1px solid #404040;
    transition: .2s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #808080;
    transition: .2s;
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: #14b8a6;
    border-color: #14b8a6;
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
    background-color: #fff;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btns .btn {
    padding: 6px 14px;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #606060;
    font-size: 14px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #303030;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #404040;
}

/* ========== 自定义确认弹窗 ========== */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(6px);
}
.confirm-overlay.show { display: flex; }

.confirm-box {
    width: 400px;
    background: #121212;
    border-radius: 14px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    padding: 32px 28px 24px;
}

.confirm-message {
    font-size: 16px;
    color: #e8e8e8;
    margin-bottom: 28px;
    line-height: 1.6;
    text-align: center;
}

.confirm-btns {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.confirm-btns .btn {
    min-width: 100px;
    padding: 10px 24px;
}

/* ========== 全局动画 ========== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
