* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, "Segoe UI", sans-serif;
    background: #f5f6fa;
    padding: 40px 20px;
}
h1 { color: #2c3e50; text-align: center; }
.login-box {
    max-width: 360px;
    margin: 60px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.login-box h2 { text-align: center; margin-bottom: 20px; color: #34495e; }
.login-box input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.login-box input:focus { border-color: #3498db; outline: none; }
.login-box button {
    width: 100%;
    padding: 10px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
}
.login-box button:hover { background: #2980b9; }
.result {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    max-height: 200px;
    overflow: auto;
    white-space: pre-wrap;
}

/* ==================== Toast 弹出框 ==================== */
.toast-wrap {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    min-width: 240px;
    max-width: 420px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toast-in .25s ease;
}
.toast.hide { animation: toast-out .25s ease forwards; }
.toast .icon { font-size: 18px; line-height: 1; }
.toast .msg { flex: 1; line-height: 1.5; word-break: break-all; }
.toast.success { background: #27ae60; }
.toast.error   { background: #e74c3c; }
.toast.warn    { background: #f39c12; }
.toast.info    { background: #3498db; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); }    to { opacity: 0; transform: translateY(-12px); } }
/* ===== 仪表盘布局 ===== */
body.dashboard { margin: 0; padding: 0; background: #f5f6fa; height: 100vh; }

/* 顶部栏（默认竖屏显示） */
.topbar { display: flex; align-items: center; gap: 12px; background: #2c3e50; color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 100; }
.topbar .brand { font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; }
.topbar .logout-btn { width: auto; padding: 4px 10px; font-size: 13px; border: 1px solid rgba(255,255,255,0.4); color: #fff; background: transparent; border-radius: 4px; cursor: pointer; }
.topbar .logout-btn:hover { background: rgba(255,255,255,0.15); }
.topbar { justify-content: flex-start; }
.menu-toggle {
    background: transparent; border: none; color: #fff;
    font-size: 20px; cursor: pointer; padding: 0;
}

.layout { display: flex; min-height: calc(100vh - 49px); }

/* 侧边栏 */
.sidebar {
    position: fixed; top: 49px; left: -240px;
    width: 240px; height: calc(100vh - 49px);
    background: #fff; border-right: 1px solid #ecf0f1;
    transition: left .25s; z-index: 99;
    display: flex; flex-direction: column;
}
.sidebar.open { left: 0; }
.sidebar-brand {
    padding: 18px 20px; font-size: 15px; font-weight: 600;
    color: #2c3e50; border-bottom: 1px solid #ecf0f1;
}
.menu { padding: 8px 0; flex: 1; }
.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px; color: #7f8c8d;
    text-decoration: none; font-size: 14px;
    transition: background .15s, color .15s;
}
.menu-item:hover { background: #f8f9fa; color: #2c3e50; }
.menu-item.active { background: #ecf0f1; color: #3498db; font-weight: 600; border-left: 3px solid #3498db; }
.menu-item .icon { font-size: 18px; }
.sidebar-footer { padding: 16px; border-top: 1px solid #ecf0f1; }
.sidebar-footer .logout-btn {
    width: 100%; padding: 8px; background: transparent; border: 1px solid #e74c3c;
    color: #e74c3c; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.sidebar-footer .logout-btn:hover { background: #e74c3c; color: #fff; }

/* 内容区 */
.content { flex: 1; padding: 24px 20px; }
.page-title { font-size: 18px; color: #2c3e50; margin: 0 0 20px; }
.hidden { display: none !important; }

/* 首页卡片 */
.card-grid { display: flex; flex-direction: column; gap: 12px; }
.card {
    background: #fff; border-radius: 8px; padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-label { font-size: 12px; color: #95a5a6; margin-bottom: 6px; }
.card-value { font-size: 18px; color: #2c3e50; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-value.row { justify-content: space-between; }
.card-highlight { border-left: 4px solid #f39c12; }

.btn-mini {
    padding: 4px 12px; font-size: 12px; border-radius: 4px;
    border: 1px solid #bdc3c7; background: #fff; color: #7f8c8d;
    cursor: pointer;
}
.btn-mini:hover { border-color: #3498db; color: #3498db; }
.btn-mini.btn-primary { background: #3498db; border-color: #3498db; color: #fff; }
.btn-mini.btn-primary:hover { background: #2980b9; border-color: #2980b9; }
.btn-mini.btn-warn { background: #fff; border-color: #e74c3c; color: #e74c3c; }
.btn-mini.btn-warn:hover { background: #fdf0ef; border-color: #c0392b; color: #c0392b; }
.btn-mini.btn-dark { background: #2c3e50; border-color: #2c3e50; color: #fff; }
.btn-mini.btn-dark:hover { background: #1a252f; border-color: #1a252f; }

/* 红色提醒菜单 item（邀请说明） */
.menu-item.menu-dark {
    color: #e74c3c;
}
.menu-item.menu-dark:hover { background: #fdf0ef; color: #c0392b; }
.menu-item.menu-dark.active { background: #ecf0f1; color: #c0392b; font-weight: 600; border-left: 3px solid #e74c3c; }

/* 兑换页 */
.exchange-wrap { max-width: 480px; }
.balance-display {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff; border-radius: 10px; padding: 24px;
    text-align: center; margin-bottom: 20px;
}
.balance-label { font-size: 13px; opacity: .9; }
.balance-number { font-size: 42px; font-weight: 700; margin-top: 6px; }
.pending-hint { font-size: 13px; color: #e67e22; margin-left: 6px; }
.card-highlight .pending-hint { font-size: 13px; color: #e67e22; font-weight: normal; }
.balance-display .pending-hint { font-size: 14px; color: #fff; opacity: .85; margin-top: 4px; display: block; }

/* 兑换类型标签 */
.type-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #fff; }
.type-point { background: #3498db; }
.type-monthly { background: #9b59b6; }
.type-quarterly { background: #27ae60; }

/* ===== 主播端兑换记录 ===== */
.title-sub { font-size: 14px; color: #888; font-weight: normal; margin-left: 6px; }
.records-wrap { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.06); overflow: hidden; }
.records-table { width: 100%; border-collapse: collapse; }
.records-table thead { background: #f8f9fa; }
.records-table th { font-size: 13px; color: #666; padding: 12px 10px; font-weight: 600; text-align: left; }
.records-table td { padding: 12px 10px; font-size: 14px; color: #333; border-top: 1px solid #f0f0f0; }
.records-table tbody tr:hover { background: #fafbfc; }
.empty-row { text-align: center; color: #999; padding: 30px 10px !important; font-size: 14px; }
.rec-time { color: #888; font-size: 12px; white-space: nowrap; }
.rec-type { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #fff; }
.rec-point { background: #3498db; }
.rec-monthly { background: #9b59b6; }
.rec-quarterly { background: #27ae60; }
.rec-potion { background: #e67e22; }
.rec-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.rec-pending { background: #fff3cd; color: #856404; }
.rec-success { background: #d4edda; color: #155724; }
.rec-rejected { background: #f8d7da; color: #721c24; }
.exchange-form {
    background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 10px;
}
.exchange-detail {
    margin-top: 4px; font-size: 13px; display: flex;
    gap: 18px; align-items: center;
}
.exchange-detail .locked-parts { color: #666; }
.exchange-detail .locked-parts b { font-weight: 600; font-size: 14px; }
.exchange-form h3 { margin: 0 0 8px; font-size: 16px; color: #2c3e50; }
.exchange-form .hint { margin: 0 0 16px; font-size: 13px; color: #95a5a6; }
.input-row { display: flex; gap: 10px; }
.input-row input {
    flex: 1; padding: 10px 12px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 14px;
    margin-bottom: 4px;
}
.input-row input:focus { border-color: #3498db; outline: none; }
.input-row .btn-primary {
    padding: 10px 20px; background: #3498db; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 14px;
}
.input-row .btn-primary:hover { background: #2980b9; }
.input-row .btn-primary:disabled { background: #95a5a6; cursor: not-allowed; }

/* 欢乐点档位选择 — 2×2 网格 */
.level-select-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.btn-level {
    padding: 10px 6px;
    border: 2px solid #3498db;
    background: #fff;
    color: #2c3e50;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all .18s;
}
.btn-level small {
    font-size: 12px;
    font-weight: 400;
    color: #95a5a6;
}
.btn-level:hover:not(:disabled) {
    background: #3498db;
    color: #fff;
    transform: translateY(-1px);
}
.btn-level:hover:not(:disabled) small { color: rgba(255,255,255,.85); }
.btn-level:disabled {
    border-color: #bdc3c7;
    background: #ecf0f1;
    color: #95a5a6;
    cursor: not-allowed;
}
.btn-level:disabled small { color: #bdc3c7; }

@media (max-width: 500px) {
    .level-select-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .btn-level { padding: 12px 8px; font-size: 14px; }
}

/* 月卡季卡兑换行 */
.card-exchange-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px; margin-bottom: 6px;
    border: 1px solid #ecf0f1; border-radius: 8px;
    background: #fafbfc;
}
.card-exchange-row:last-child { margin-bottom: 0; }
.card-info { display: flex; flex-direction: column; gap: 4px; }
.card-name { font-size: 15px; font-weight: 600; color: #2c3e50; }
.card-price { font-size: 14px; font-weight: 600; color: #e67e22; white-space: nowrap; }
.btn-card-exchange {
    padding: 8px 18px; background: #e67e22; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 14px;
    white-space: nowrap;
}
.btn-card-exchange:hover { background: #d35400; }
.btn-card-exchange:disabled { background: #95a5a6; cursor: not-allowed; }

/* ===== 邀请说明页面 ===== */
.rules-wrap { max-width: 600px; }
.rules-card {
    background: #fff; border-radius: 10px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rules-section { margin-bottom: 22px; }
.rules-section:last-child { margin-bottom: 0; }
.rules-title {
    font-size: 15px; font-weight: 600; color: #2c3e50;
    margin-bottom: 12px; padding-left: 10px;
    border-left: 3px solid #e74c3c;
}
.rule-notice {
    background: #fff7e6; border: 1px solid #ffd591; border-radius: 6px;
    padding: 10px 14px; margin-bottom: 12px;
    font-size: 13px; color: #d46b08; line-height: 1.6;
}
.rules-list { list-style: none; padding: 0; }
.rules-list li {
    position: relative; padding: 4px 14px 4px 34px;
    background: #fafbfc; border-radius: 6px;
    margin-bottom: 2px; font-size: 14px; color: #34495e;
    line-height: 1.6;
}
.rules-list li:last-child {
    margin-bottom: 0;
}

/* 警告提示条（推广规范前置警告） */
.rules-list li.rule-notice {
    background: #fffbe6;
    border-left: 3px solid #fa8c16;
    padding: 8px 12px;
    font-weight: 600;
    color: #d46b08;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
}
.rules-list li::before {
    content: attr(data-num);
    position: absolute; left: 10px; top: 5px;
    width: 18px; height: 18px;
    background: #2c3e50; color: #fff;
    border-radius: 50%; font-size: 11px;
    line-height: 18px; text-align: center;
    font-weight: 600;
}
.rules-tip {
    background: #fef9e7; border: 1px solid #f9e79f;
    border-radius: 6px; padding: 12px 14px;
    font-size: 13px; color: #7d6608;
    line-height: 1.6;
}
.rules-tip strong { color: #b7950b; }

/* ===== 折叠面板（规则 5 / 6） ===== */
.accordion-section { margin-bottom: 14px; border: 1px solid #eaecef; border-radius: 8px; overflow: hidden; }
.accordion-header {
    width: 100%; padding: 14px 16px;
    background: #f8f9fa; border: none;
    font-size: 14px; font-weight: 600; color: #2c3e50;
    cursor: pointer; display: flex; align-items: center; gap: 10px;
    transition: background .2s;
}
.accordion-header:hover { background: #ecf0f1; }
.accordion-header .acc-icon { font-size: 16px; }
.accordion-header .acc-arrow { margin-left: auto; font-size: 12px; color: #7f8c8d; transition: transform .25s; }
.accordion-header.open .acc-arrow { transform: rotate(90deg); }
.accordion-body { padding: 0; }
.accordion-body.hidden { display: none; }
.accordion-body.open { padding: 16px; }
.acc-content {
    font-size: 13px; color: #34495e; line-height: 1.8;
    white-space: pre-wrap; word-break: break-word;
}
.acc-content h4,
.acc-content strong { color: #c0392b; }
.acc-content hr { border: none; border-top: 1px dashed #eaecef; margin: 14px 0; }

/* ===== 横屏 (≥768px)：左侧菜单 ===== */
@media (min-width: 768px) {
    .topbar { display: none; }
    .layout { min-height: 100vh; }
    .sidebar { top: 0; left: 0; height: 100vh; }
    .content { margin-left: 240px; padding: 32px 40px; }
    .card-grid {
        flex-direction: row; flex-wrap: wrap;
    }
    .card { flex: 0 0 calc(50% - 6px); }
    .card-highlight { flex: 0 0 100%; }
}