/* =============================================================
   Mouth Streamer · Admin Theme
   "数据中转" 风格的暗色主题，登录页 + 后台共用
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #0a0f1f;
    color: #e5e7eb;
    min-height: 100vh;
}
a { color: #06b6d4; text-decoration: none; }
a:hover { color: #22d3ee; }

/* ── 字体辅助 ───────────────────────────────────── */
.mono { font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; }

/* ── 全局动效 ───────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.3); }
}
@keyframes flow {
    0%   { left: -10px; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { left: calc(100% + 10px); opacity: 0; }
}

/* =============================================================
   登录页（居中卡片 + 数据流背景）
   ============================================================= */

.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
}
.login-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(6, 182, 212, 0.15), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.12), transparent 40%),
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
    pointer-events: none;
}
.data-flow {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.data-flow span {
    position: absolute;
    width: 4px; height: 4px;
    background: #06b6d4;
    border-radius: 50%;
    box-shadow: 0 0 10px #06b6d4, 0 0 20px rgba(6, 182, 212, 0.5);
    opacity: 0;
    animation: flow 6s linear infinite;
}
.data-flow span:nth-child(1) { top: 12%; animation-delay: 0s;   animation-duration: 7s; }
.data-flow span:nth-child(2) { top: 28%; animation-delay: 1.2s; animation-duration: 5.5s; background: #8b5cf6; box-shadow: 0 0 10px #8b5cf6, 0 0 20px rgba(139,92,246,.5); }
.data-flow span:nth-child(3) { top: 45%; animation-delay: 2.5s; animation-duration: 6.5s; }
.data-flow span:nth-child(4) { top: 62%; animation-delay: 0.5s; animation-duration: 8s;   background: #14b8a6; box-shadow: 0 0 10px #14b8a6, 0 0 20px rgba(20,184,166,.5); }
.data-flow span:nth-child(5) { top: 80%; animation-delay: 3s;   animation-duration: 6s; }
.data-flow span:nth-child(6) { top: 92%; animation-delay: 1.8s; animation-duration: 7.5s; background: #8b5cf6; box-shadow: 0 0 10px #8b5cf6, 0 0 20px rgba(139,92,246,.5); }

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(17, 24, 39, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 25px 60px -15px rgba(0, 0, 0, 0.7),
        0 0 80px rgba(6, 182, 212, 0.08);
    padding: 40px 36px 32px;
}

.pipeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 28px;
    padding: 10px 14px;
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: 10px;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-size: 11px;
    color: #94a3b8;
}
.node { display: flex; align-items: center; gap: 6px; }
.node-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #06b6d4;
    box-shadow: 0 0 8px #06b6d4;
    animation: pulse 1.5s ease-in-out infinite;
}
.node:nth-child(3) .node-dot { background: #8b5cf6; box-shadow: 0 0 8px #8b5cf6; animation-delay: 0.5s; }
.node:nth-child(5) .node-dot { background: #14b8a6; box-shadow: 0 0 8px #14b8a6; animation-delay: 1s; }
.arrow { color: #475569; font-size: 14px; }

.brand { text-align: center; margin-bottom: 28px; }
.brand-icon { width: 56px; height: 56px; margin: 0 auto 14px; display: block; }
.brand h1 { font-size: 20px; margin: 0; color: #f1f5f9; font-weight: 600; letter-spacing: 0.3px; }
.brand .subtitle {
    margin: 6px 0 0;
    font-size: 12px;
    color: #64748b;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =============================================================
   后台主框架（侧栏 + 顶栏 + 内容区）
   ============================================================= */

.app {
    display: flex;
    min-height: 100vh;
    position: relative;
}
.app::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(6, 182, 212, 0.08), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.06), transparent 40%);
    pointer-events: none;
    z-index: 0;
}
.app > * { position: relative; z-index: 1; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: rgba(13, 18, 33, 0.7);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(148, 163, 184, 0.08);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 22px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    margin-bottom: 14px;
}
.sidebar-brand svg, .sidebar-brand img { width: 32px; height: 32px; display: block; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-text strong { font-size: 14px; color: #f1f5f9; font-weight: 600; }
.sidebar-brand-text span {
    font-size: 10px;
    color: #64748b;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sidebar-section {
    font-size: 11px;
    color: #cbd5e1;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    font-weight: 600;
    padding: 10px 10px 8px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    position: relative;
}
.sidebar-section::before {
    content: "";
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, #64748b, #334155);
    flex-shrink: 0;
}
.sidebar-section .sec-label { flex: 1; }
.sidebar-section .sec-tag {
    font-size: 9px;
    letter-spacing: 1px;
    color: #0a0f1f;
    background: linear-gradient(135deg, #22d3ee, #8b5cf6);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.sidebar-section-primary {
    color: #67e8f9;
    font-size: 12px;
    background: linear-gradient(90deg, rgba(6,182,212,0.14), rgba(6,182,212,0));
    border: 1px solid rgba(6,182,212,0.25);
    box-shadow: 0 0 24px rgba(6,182,212,0.10);
}
.sidebar-section-primary::before {
    height: 16px;
    background: linear-gradient(180deg, #22d3ee, #8b5cf6);
    box-shadow: 0 0 8px rgba(34,211,238,0.7);
}
.sidebar-nav-primary { padding: 4px 0 6px; }
.sidebar-nav-primary a { color: #cbd5e1; }
.sidebar-nav-primary a:hover { background: rgba(6,182,212,0.08); color: #67e8f9; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
}
.sidebar-nav a:hover { background: rgba(148, 163, 184, 0.06); color: #e5e7eb; }
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(6,182,212,0.12), rgba(6,182,212,0.02));
    color: #06b6d4;
    box-shadow: inset 2px 0 0 #06b6d4;
}
.sidebar-nav .nav-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}
.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    font-size: 11px;
    color: #475569;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
.sidebar-foot .status-line { display: flex; align-items: center; gap: 6px; padding: 4px 10px; }
.sidebar-foot .status-line::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: pulse 1.8s ease-in-out infinite;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 56px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(13, 18, 33, 0.5);
    backdrop-filter: blur(12px);
}
.topbar-crumb {
    font-size: 13px;
    color: #94a3b8;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    letter-spacing: 0.5px;
}
.topbar-crumb .sep { color: #475569; margin: 0 8px; }
.topbar-crumb strong { color: #f1f5f9; font-weight: 500; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cbd5e1; }
.topbar-user .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; color: #fff;
}

.content { padding: 28px 28px 40px; flex: 1; }
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 22px; font-weight: 600; color: #f1f5f9; }
.page-sub { margin: 4px 0 0; font-size: 12px; color: #64748b; font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; letter-spacing: 0.5px; }

/* =============================================================
   通用组件
   ============================================================= */

/* ── Card ──────────────────────────────── */
.card {
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    overflow: hidden;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #cbd5e1;
}
.card-body { padding: 18px; }

/* ── Alert ────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-error   { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(34, 197, 94, 0.08); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }

/* ── Form ─────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 6px;
    font-weight: 500;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-size: 14px;
    color: #f1f5f9;
    background: rgba(15, 23, 42, 0.6);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}
.field input::placeholder { color: #475569; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #06b6d4;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* ── Buttons ──────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    background: transparent;
    color: #cbd5e1;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #14b8a6 100%);
    color: #fff;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-size: 12px;
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3); }
.btn-primary:active { transform: translateY(1px); }
.btn-block { width: 100%; justify-content: center; padding: 12px 16px; }

.btn-ghost {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.4);
    color: #cbd5e1;
}
.btn-ghost:hover { border-color: rgba(6, 182, 212, 0.4); color: #06b6d4; background: rgba(6, 182, 212, 0.06); }

.btn-danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.06); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.15); color: #fecaca; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Table ────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.4);
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-weight: 500;
    white-space: nowrap;
}
.table td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    font-size: 14px;
    color: #cbd5e1;
    vertical-align: middle;
}
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: rgba(6, 182, 212, 0.04); }
.table tbody tr:last-child td { border-bottom: none; }
.table .col-actions { white-space: nowrap; text-align: right; }
.table .cell-mono { font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; font-size: 13px; color: #94a3b8; }

.empty {
    padding: 56px 20px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* ── Badge / chip ─────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-weight: 500;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-active   { background: rgba(34, 197, 94, 0.1);  color: #86efac; border-color: rgba(34, 197, 94, 0.25); }
.badge-disabled { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border-color: rgba(148, 163, 184, 0.25); }
.badge-locked   { background: rgba(239, 68, 68, 0.1);  color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }

.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    background: rgba(6, 182, 212, 0.1);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.25);
    margin-right: 4px;
}

/* ── Pagination ───────────────────────── */
.pager {
    padding: 14px 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
.pager-actions { display: flex; gap: 6px; }

/* ── Modal ────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 12px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.7), 0 0 80px rgba(6,182,212,0.1);
    overflow: hidden;
}
.modal-head {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-head h3 { margin: 0; font-size: 15px; color: #f1f5f9; }
.modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: #f1f5f9; }
.modal-body { padding: 20px; }
.modal-foot {
    padding: 14px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* inline form helpers */
.form-inline { display: inline-block; margin: 0; }
.flex-gap { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── 权限分配（模块 + 复选框网格） ──────── */
.perm-module {
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
}
.perm-module-head {
    padding: 11px 16px;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.perm-module-head .module-name {
    font-size: 13px;
    color: #f1f5f9;
    font-weight: 500;
}
.perm-module-head .module-count {
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-size: 11px;
    color: #64748b;
}
.perm-module-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    padding: 14px 16px;
}
.perm-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    background: rgba(15, 23, 42, 0.3);
    user-select: none;
}
.perm-check:hover { border-color: rgba(6, 182, 212, 0.3); background: rgba(6, 182, 212, 0.04); }
.perm-check input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: #06b6d4;
    cursor: pointer;
    flex-shrink: 0;
}
.perm-check.checked { border-color: rgba(6, 182, 212, 0.4); background: rgba(6, 182, 212, 0.08); }
.perm-check .perm-name { font-size: 13px; color: #cbd5e1; }
.perm-check .perm-code {
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-size: 11px;
    color: #64748b;
    margin-left: auto;
}

/* sticky 表单底部按钮 */
.form-actions {
    display: flex;
    gap: 10px;
    padding: 16px 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    background: rgba(13, 18, 33, 0.5);
    position: sticky;
    bottom: 0;
}
