:root {
    --brand: #1d9aff;
    --brand-deep: #0b6fd8;
    --brand-soft: rgba(29, 154, 255, .12);
    --ink: #16233c;
    --muted: #7d8aa3;
    --line: #e7ecf4;
    --bg: #f4f7fb;
    --white: #fff;
    --danger: #f04438;
    --success: #12b76a;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(22, 35, 60, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */

.login {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at 18% 20%, #2b7dff 0, #0d3ea8 42%, #081a45 100%);
    z-index: 30;
}

.login-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: .5;
}

.glow-a {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(76, 201, 255, .55), transparent 68%);
    top: -140px;
    right: -100px;
}

.glow-b {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(94, 106, 255, .4), transparent 70%);
    bottom: -220px;
    left: -120px;
}

.login-card {
    position: relative;
    width: 380px;
    max-width: calc(100vw - 40px);
    padding: 36px 34px 30px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 30px 80px rgba(3, 16, 48, .45);
    z-index: 2;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #37a4ff, #0b6fd8);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(29, 154, 255, .35);
}

.login-brand h1 {
    margin: 0;
    font-size: 21px;
    letter-spacing: .5px;
}

.login-brand p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 2px;
}

.form-label {
    display: block;
    margin-bottom: 16px;
    color: #47536b;
    font-size: 13px;
    font-weight: 600;
}

.input {
    width: 100%;
    height: 44px;
    margin-top: 8px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafcff;
    color: var(--ink);
    font-size: 14px;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}

.input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.login-hint {
    margin: 16px 0 0;
    color: #98a4b8;
    font-size: 12px;
    text-align: center;
}

.login-foot {
    position: relative;
    margin: 26px 0 0;
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
    letter-spacing: 1px;
    z-index: 2;
}

/* ---------------- 布局 ---------------- */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #101d3b 0%, #0b1630 100%);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 22px 22px;
}

.brand-text b {
    display: block;
    font-size: 16px;
    letter-spacing: .5px;
}

.brand-text small {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, .45);
    font-size: 11px;
    letter-spacing: 1px;
}

.nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 44px;
    padding: 0 14px;
    margin-bottom: 4px;
    border: 0;
    border-radius: 10px;
    width: 100%;
    background: transparent;
    color: rgba(255, 255, 255, .62);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background .16s, color .16s;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, #2b9dff, #0d6fd7);
    box-shadow: 0 8px 18px rgba(13, 111, 215, .35);
}

.side-foot {
    padding: 18px 22px;
    color: rgba(255, 255, 255, .28);
    font-size: 11px;
    letter-spacing: .5px;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 0 28px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 0 20px;
}

.page-heading h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: .3px;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #4c5a74;
    font-size: 13px;
}

.user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(18, 183, 106, .14);
}

/* ---------------- 通用组件 ---------------- */

.content { min-height: 200px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .16s;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.primary {
    background: linear-gradient(135deg, #2b9dff, #0b6fd8);
    color: #fff;
    box-shadow: 0 7px 16px rgba(29, 154, 255, .28);
}

.btn.primary:hover { box-shadow: 0 9px 20px rgba(29, 154, 255, .36); }

.btn.ghost {
    border-color: var(--line);
    background: #fff;
    color: #4c5a74;
}

.btn.ghost:hover { border-color: #c9d6e8; }

.btn.danger {
    background: #fff1f0;
    border-color: #ffd6d3;
    color: var(--danger);
}

.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; }

.btn.block { width: 100%; height: 44px; font-size: 14px; }

.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.icon-btn {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8b97ab;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover { background: var(--bg); color: var(--ink); }

.panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(231, 236, 244, .85);
    overflow: hidden;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

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

.input.sm, .select.sm {
    width: 210px;
    height: 38px;
    margin: 0;
    background: #fff;
}

.select {
    height: 38px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8aa3' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
    color: var(--ink);
    font-size: 13px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px 16px;
    background: #f8fafd;
    color: #7a879c;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f4f9;
    vertical-align: middle;
    font-size: 13px;
    color: #37445d;
}

tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }

.thumb {
    width: 52px;
    height: 52px;
    border-radius: 9px;
    object-fit: cover;
    background: #eef3fa;
    display: block;
}

.thumb.avatar { border-radius: 50%; }

.thumb-empty {
    width: 52px;
    height: 52px;
    border-radius: 9px;
    background: #eef3fa;
    color: #a9b6c9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { margin-top: 4px; color: #94a0b4; font-size: 11px; }

.pill {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 20px;
    background: #f1f4f9;
    color: #7a879c;
    font-size: 11px;
    white-space: nowrap;
}

.pill.on { background: rgba(18, 183, 106, .1); color: #0d9f5e; }
.pill.off { background: #f2f4f7; color: #98a4b8; }

.row-actions { display: flex; gap: 6px; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pagination .pages { display: flex; gap: 8px; }

.loading, .empty {
    padding: 60px 20px;
    text-align: center;
    color: #9aa7bb;
    font-size: 13px;
}

.tabs {
    display: inline-flex;
    padding: 4px;
    background: #eaf0f8;
    border-radius: 10px;
    margin-bottom: 16px;
}

.tab {
    height: 32px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b7a92;
    font-size: 13px;
    cursor: pointer;
}

.tab.active {
    background: #fff;
    color: var(--brand-deep);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(22, 35, 60, .08);
}

/* ---------------- 轮播卡片 ---------------- */

.banner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.banner-card {
    background: #fff;
    border: 1px solid rgba(231, 236, 244, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.banner-card .pic {
    height: 152px;
    background: #eef3fa center/cover no-repeat;
}

.banner-card .info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
}

.banner-card .meta { color: #94a0b4; font-size: 12px; }
.banner-card .actions { display: flex; gap: 6px; }

/* ---------------- 表单 ---------------- */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
}

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

.form-item label {
    display: block;
    margin-bottom: 7px;
    color: #566278;
    font-size: 12px;
    font-weight: 600;
}

.form-item .hint {
    margin-top: 6px;
    color: #9aa7bb;
    font-size: 11px;
    line-height: 1.6;
}

.form-item input.input,
.form-item select.select {
    margin: 0;
    width: 100%;
}

textarea.input {
    height: auto;
    min-height: 110px;
    padding: 11px 14px;
    line-height: 1.65;
    resize: vertical;
    font-family: inherit;
}

textarea.input.tall { min-height: 180px; }

.section-card {
    background: #fff;
    border: 1px solid rgba(231, 236, 244, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 18px;
}

.section-card h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 6px;
    font-size: 15px;
}

.section-card h3::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(180deg, #36a6ff, #0b6fd8);
}

.section-card .desc {
    margin: 0 0 18px;
    color: #93a0b5;
    font-size: 12px;
    line-height: 1.6;
}

.upload-field {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.upload-preview {
    width: 118px;
    height: 118px;
    border: 1px dashed #d5e0ee;
    border-radius: 10px;
    background: #f9fbfe center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a8b5c7;
    font-size: 11px;
    overflow: hidden;
}

.upload-preview.round { border-radius: 50%; }

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.audio-preview { width: 100%; margin-top: 10px; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    background: rgba(9, 20, 42, .55);
    backdrop-filter: blur(2px);
    overflow-y: auto;
}

.modal {
    width: 560px;
    max-width: 100%;
    margin: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(6, 20, 48, .35);
    animation: pop .18s ease-out;
}

.modal.wide { width: 760px; }

@keyframes pop {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 14px;
}

.modal-head h3 { margin: 0; font-size: 17px; }

.modal-body { padding: 4px 24px 8px; }

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
}

.confirm-text {
    padding: 10px 0 18px;
    color: #4a5770;
    line-height: 1.8;
}

/* ---------------- 提示 ---------------- */

.toast {
    position: fixed;
    left: 50%;
    top: 24px;
    z-index: 90;
    transform: translate(-50%, -16px);
    max-width: 80vw;
    padding: 11px 18px;
    border-radius: 10px;
    background: rgba(22, 35, 60, .94);
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    box-shadow: 0 12px 30px rgba(6, 20, 48, .25);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #d92d20; }
.toast.success { background: #12805c; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 980px) {
    .layout { display: block; }
    .sidebar {
        position: static;
        height: auto;
        width: auto;
        flex-direction: row;
        align-items: center;
        padding: 8px 10px;
        overflow-x: auto;
    }
    .brand { padding: 8px 12px; flex-shrink: 0; }
    .brand-text small { display: none; }
    .nav { display: flex; flex: 1; padding: 0; overflow-x: auto; }
    .nav-item { width: auto; flex-shrink: 0; height: 38px; margin: 0 2px; padding: 0 12px; }
    .nav-item span { white-space: nowrap; }
    .side-foot { display: none; }
    .main { padding: 0 16px 30px; }
    .topbar { padding-top: 18px; align-items: flex-start; }
    .userbox { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .page-heading h2 { font-size: 18px; }
    .page-heading p { display: none; }
    .btn.ghost.sm { height: 30px; padding: 0 9px; }
    .form-grid { grid-template-columns: 1fr; }
    .input.sm, .select.sm { width: 100%; }
    .filters { width: 100%; }
    .filters .input.sm { flex: 1; }
    .toolbar > .btn { width: 100%; }
    .modal-mask { padding: 16px 10px; }
    .modal-body { padding: 4px 18px 8px; }
    .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
}
