/* 由 frontend/pages/black-room.php 拆分而来，改样式改这里。 */
    /* ========== 小黑屋 · 卡片流（E 方案） ========== */
    .bh-light-page,
    .bh-light-page *,
    .bh-light-page *::before,
    .bh-light-page *::after { box-sizing: border-box; }
    .bh-light-page {
        --bh-text: #1a1b22;
        --bh-sub: #5b5d6b;
        --bh-muted: #8b8d9a;
        --bh-line: #e6e7ef;
        --bh-card: #fff;
        --bh-cell: #f7f8fc;
        --bh-chip: #eceef5;
        --bh-shell: #fbfcfe;
        --bh-theme: var(--theme-color, #f4a31f);
        --bh-theme-rgb: var(--theme-color-rgb, 244, 163, 31);
        --bh-mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;
        min-height: 100vh;
        color: var(--bh-text);
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
    }
    .bh-container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

    /* ========== 外壳：橙色横幅 + 白色内容区 ========== */
    .bh-shell {
        background: var(--bh-shell);
        border-radius: 18px;
        overflow: hidden;
        box-shadow: 0 18px 50px -30px rgba(24, 20, 60, .35);
    }
    .bh-main { padding: 20px 24px 6px; }

    /* ========== Hero（通栏橙色横幅） ========== */
    .bh-hero {
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 20px;
        padding: 24px 28px 22px;
        background: linear-gradient(103deg, #f19d12 0%, #f7ac26 48%, #ffb93f 100%);
        color: #fff;
    }
    .bh-hero::before {
        content: "";
        position: absolute;
        right: -60px;
        top: -90px;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .14);
        pointer-events: none;
    }
    .bh-hero-txt { position: relative; z-index: 1; min-width: 0; }
    .bh-hero__title {
        margin: 0;
        font-size: 26px;
        line-height: 1.2;
        font-weight: 800;
        letter-spacing: .5px;
        color: #fff;
        text-shadow: 0 2px 10px rgba(120, 70, 0, .22);
    }
    .bh-hero__subtitle {
        margin: 9px 0 0;
        font-size: 13px;
        line-height: 1.5;
        color: rgba(255, 255, 255, .94);
        letter-spacing: .2px;
    }
    /* 右上装饰块 */
    .bh-art {
        position: relative;
        z-index: 1;
        flex: none;
        width: 96px;
        height: 74px;
        border-radius: 10px;
        background: rgba(255, 255, 255, .20);
        border: 1px solid rgba(255, 255, 255, .30);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }
    .bh-art i { display: flex; align-items: center; justify-content: center; color: #fff; }
    .bh-art i svg { width: 26px; height: 26px; }
    .bh-art b { display: block; width: 46px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .55); }
    .bh-art b + b { width: 30px; background: rgba(255, 255, 255, .35); }
    /* 横幅渐变跟随主题色 */
    @supports (color: color-mix(in srgb, red, blue)) {
        .bh-hero {
            background: linear-gradient(103deg,
                color-mix(in srgb, var(--bh-theme) 90%, #000) 0%,
                var(--bh-theme) 48%,
                color-mix(in srgb, var(--bh-theme) 86%, #fff) 100%);
        }
    }

    /* ========== Flash（去毛玻璃） ========== */
    .bh-flash {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(-100px);
        padding: 12px 24px;
        border-radius: 10px;
        font-weight: 600;
        font-size: 14px;
        z-index: 10000;
        opacity: 0;
        transition: all .4s cubic-bezier(.34, 1.56, .64, 1);
        box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .35);
    }
    .bh-flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }
    .bh-flash.success { background: #15803d; color: #fff; }
    .bh-flash.error { background: #b91c1c; color: #fff; }

    /* ========== Stats（横幅内的白透胶囊） ========== */
    .bh-stats { display: flex; justify-content: flex-start; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
    .bh-stat {
        display: flex;
        align-items: baseline;
        gap: 6px;
        padding: 5px 12px;
        border-radius: 20px;
        background: rgba(255, 255, 255, .20);
        border: 1px solid rgba(255, 255, 255, .28);
    }
    .bh-stat__icon { display: none; }
    .bh-stat__num { order: 2; font-size: 13.5px; font-weight: 800; color: #fff; letter-spacing: -.01em; }
    .bh-stat__label { order: 1; font-size: 12px; color: rgba(255, 255, 255, .9); font-weight: 400; }

    /* ========== Admin 表单 ========== */
    .admin-card {
        background: var(--bh-card);
        border: 1px solid var(--bh-line);
        border-radius: 14px;
        padding: 20px;
        margin-bottom: 22px;
    }
    .admin-card h3 { margin: 0 0 18px; font-size: 15px; font-weight: 800; color: var(--bh-text); }
    .add-ban-form { display: flex; flex-wrap: wrap; gap: 14px; }
    .form-row { display: flex; gap: 14px; flex: 2; flex-wrap: wrap; }
    .form-group { flex: 1; min-width: 180px; }
    .form-group label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        margin-bottom: 7px;
        color: var(--bh-sub);
        letter-spacing: .02em;
    }
    .form-group input, .form-group textarea {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid var(--bh-line);
        border-radius: 8px;
        font-size: 14px;
        color: var(--bh-text);
        background: var(--bh-cell);
        transition: border-color .2s, box-shadow .2s, background .2s;
        -webkit-appearance: none;
        font-family: inherit;
    }
    .form-group input:focus, .form-group textarea:focus {
        outline: none;
        border-color: rgba(var(--bh-theme-rgb), .55);
        box-shadow: 0 0 0 3px rgba(var(--bh-theme-rgb), .12);
        background: var(--bh-card);
    }
    .form-group input::placeholder, .form-group textarea::placeholder { color: var(--bh-muted); }
    /* date 空值时 WebKit 内部高度会塌陷，显式定高兜底 */
    .form-group input[type="date"] {
        color-scheme: light;
        height: 42px;          /* 10+10 padding + 1+1 border + 20 行高 */
        line-height: 20px;
    }
    .form-group input[type="date"]::-webkit-date-and-time-value {
        min-height: 20px;
        text-align: left;      /* iOS 上默认会右对齐 */
    }
    .form-group input[type="date"]::-webkit-datetime-edit {
        padding: 0;
        min-height: 20px;
        line-height: 20px;
    }
    .form-group input[type="date"]::-webkit-calendar-picker-indicator {
        margin: 0;
        padding: 0;
        opacity: .65;
        cursor: pointer;
    }

    .ip-type-toggle { display: flex; gap: 4px; margin-bottom: 14px; }
    .ip-type-btn {
        padding: 8px 18px;
        border: 1px solid var(--bh-line);
        border-radius: 8px;
        background: var(--bh-card);
        cursor: pointer;
        font-size: 12.5px;
        font-weight: 700;
        color: var(--bh-sub);
        transition: .18s;
        font-family: inherit;
    }
    .ip-type-btn.active { background: var(--bh-theme); border-color: var(--bh-theme); color: #3d2900; }
    .ip-type-btn:hover:not(.active) { border-color: rgba(var(--bh-theme-rgb), .5); color: var(--bh-text); }

    .help-text { font-size: 11.5px; color: var(--bh-muted); margin-top: 5px; }

    .btn-submit {
        background: var(--bh-theme);
        color: #3d2900;
        border: none;
        padding: 10px 26px;
        border-radius: 9px;
        font-weight: 800;
        font-size: 13.5px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        transition: .18s;
        font-family: inherit;
        box-shadow: 0 8px 18px -10px rgba(var(--bh-theme-rgb), .9);
    }
    .btn-submit:hover { filter: brightness(1.05); transform: translateY(-1px); }
    .btn-submit:active { transform: translateY(0); }
    .btn-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }
    .btn-submit .btn-loading {
        display: none;
        width: 16px;
        height: 16px;
        border: 2.5px solid rgba(61, 41, 0, .25);
        border-top-color: #3d2900;
        border-radius: 50%;
        animation: bh-spin .7s linear infinite;
    }
    .btn-submit.loading .btn-loading { display: inline-block; }
    .btn-submit.loading .btn-text { display: none; }
    @keyframes bh-spin { to { transform: rotate(360deg); } }

    /* ========== 工具栏 ========== */
    .bh-console { margin-bottom: 26px; }
    .bh-console-head { display: none; }

    .bh-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
    .bh-search {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 200px;
        background: var(--bh-card);
        border: 1px solid var(--bh-line);
        border-radius: 10px;
        padding: 0 12px;
        transition: border-color .2s, box-shadow .2s;
    }
    .bh-search:focus-within {
        border-color: rgba(var(--bh-theme-rgb), .55);
        box-shadow: 0 0 0 3px rgba(var(--bh-theme-rgb), .12);
    }
    .bh-search-icon { position: static; transform: none; color: var(--bh-theme); font-size: 15px; line-height: 1; }
    .bh-search input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        padding: 10px 0;
        font-size: 13.5px;
        color: var(--bh-text);
        font-family: inherit;
    }
    .bh-search input::placeholder { color: var(--bh-muted); }

    .bh-filter-group { display: flex; gap: 4px; flex: 0 0 auto; }
    .bh-filter {
        padding: 8px 16px;
        border: 1px solid var(--bh-line);
        border-radius: 8px;
        background: var(--bh-card);
        color: var(--bh-sub);
        font-size: 12.5px;
        font-weight: 700;
        cursor: pointer;
        transition: .18s;
        white-space: nowrap;
        font-family: inherit;
    }
    .bh-filter:hover:not(.active) { color: var(--bh-text); border-color: rgba(var(--bh-theme-rgb), .45); }
    .bh-filter.active {
        background: var(--bh-theme);
        border-color: var(--bh-theme);
        color: #3d2900;
        box-shadow: 0 6px 14px -8px rgba(var(--bh-theme-rgb), .9);
    }

    /* ========== 卡片流 ========== */
    .bh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
    .bh-card {
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background: var(--bh-card);
        border: 1px solid var(--bh-line);
        border-radius: 14px;
        padding: 15px 17px;
        transition: border-color .25s, box-shadow .25s, background .25s;
    }
    /* 悬停效果对齐主题 .posts-item */
    .bh-card:hover {
        border-color: var(--bh-theme);
        box-shadow: 0 3px 10px 0 var(--main-shadow, rgba(0, 0, 0, .08));
    }
    .bh-card.card-new { animation: bh-card-in .4s ease-out; }
    @keyframes bh-card-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
    .bh-card.card-removing { animation: bh-card-out .3s ease-in forwards; }
    @keyframes bh-card-out { to { opacity: 0; transform: scale(.95); height: 0; padding: 0; margin: 0; overflow: hidden; } }

    .bh-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
    .bh-status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
    .bh-status-dot.dot-active { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .13); }
    .bh-status-dot.dot-expired { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .15); }

    .bh-card__ip {
        font-family: var(--bh-mono);
        font-size: 14px;
        font-weight: 700;
        color: var(--bh-text);
        letter-spacing: -.01em;
    }
    .bh-card__type-badge {
        font-size: 10.5px;
        font-weight: 500;
        color: var(--bh-muted);
        background: var(--bh-cell);
        padding: 2px 7px;
        border-radius: 4px;
        white-space: nowrap;
    }
    .type-range { background: rgba(var(--bh-theme-rgb), .13); color: #a86800; }
    .bh-card__country {
        margin-left: auto;
        font-size: 11px;
        color: var(--bh-muted);
        background: none;
        padding: 0;
        white-space: nowrap;
    }
    .bh-card__reason { font-size: 12.5px; line-height: 1.7; color: var(--bh-sub); margin-bottom: 10px; }

    .bh-card__foot {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        margin-top: auto;
        padding-top: 9px;
        border-top: 1px dashed var(--bh-line);
        font-size: 11px;
        color: var(--bh-muted);
    }
    .bh-card__time { color: var(--bh-muted); }
    .bh-exp {
        font-size: 11px;
        font-weight: 700;
        color: var(--bh-text);
        background: var(--bh-chip);
        padding: 1px 7px;
        border-radius: 4px;
        white-space: nowrap;
    }

    /* 已过期灰化 */
    .bh-card.expired { background: var(--bh-cell); }
    .bh-card.expired:hover { border-color: var(--bh-line); box-shadow: none; }
    .bh-card.expired .bh-card__ip { color: var(--bh-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
    .bh-card.expired .bh-card__reason { color: var(--bh-muted); }
    .bh-card.expired .bh-card__type-badge { background: transparent; border: 1px solid var(--bh-line); color: var(--bh-muted); }
    .bh-card.expired .bh-exp { color: var(--bh-muted); background: transparent; padding: 1px 0; }
    .bh-card.expired .bh-card__country,
    .bh-card.expired .bh-card__time { color: #a9abb8; }

    .bh-card__actions { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--bh-line); text-align: right; }
    .btn-delete {
        background: none;
        border: 1px solid var(--bh-line);
        color: var(--bh-muted);
        padding: 4px 12px;
        border-radius: 7px;
        font-size: 11.5px;
        cursor: pointer;
        font-weight: 600;
        transition: .18s;
        font-family: inherit;
    }
    .btn-delete:hover { border-color: #dc2626; color: #dc2626; background: rgba(220, 38, 38, .06); }
    .btn-delete:disabled { opacity: .4; cursor: not-allowed; }

    /* ========== 空状态 / 页脚 ========== */
    .bh-empty { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--bh-muted); font-size: 14px; }
    .bh-empty-icon {
        width: 44px;
        height: 44px;
        margin: 0 auto 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        color: var(--bh-muted);
        background: var(--bh-cell);
        border-radius: 50%;
    }
    .bh-footer { text-align: center; padding: 12px 0 16px; color: var(--bh-muted); font-size: 12px; }

    /* ========== 响应式 ========== */
    @media (max-width: 560px) {
        /* 窄屏装饰块会挤压统计胶囊，隐藏掉让胶囊一行放得下 */
        .bh-art { display: none; }
    }
    @media (max-width: 420px) {
        .bh-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
        .bh-stat { justify-content: center; }
    }
    @media (max-width: 760px) {
        .bh-container { padding: 0 14px; }
        .bh-shell { border-radius: 14px; }
        .bh-main { padding: 16px 14px 4px; }
        .bh-hero { padding: 20px 18px; gap: 12px; }
        .bh-hero__title { font-size: 21px; }
        .bh-hero__subtitle { margin-top: 7px; font-size: 12px; }
        .bh-art { width: 72px; height: 58px; }
        .bh-art i svg { width: 21px; height: 21px; }
        .bh-art b { width: 36px; height: 2.5px; }
        .bh-art b + b { width: 24px; }
        .bh-list { grid-template-columns: 1fr; }
        .bh-toolbar { flex-direction: column; align-items: stretch; }
        .bh-search { width: 100%; min-width: 0; }
        .bh-filter-group { width: 100%; }
        .bh-filter { flex: 1; text-align: center; padding: 8px 6px; }
        .form-row { flex-direction: column; }
        .ip-type-toggle { width: 100%; }
        .ip-type-btn { flex: 1; text-align: center; }
        .admin-card { padding: 16px; }
    }

    /* ========== 夜间模式 ========== */
    html.io-black-mode .bh-light-page {
        --bh-text: #e9ebf2;
        --bh-sub: #aeb1c0;
        --bh-muted: #81849a;
        --bh-line: #31333d;
        --bh-card: #24262d;
        --bh-cell: #2c2e37;
        --bh-chip: rgba(255, 255, 255, .09);
        --bh-shell: #1f2027;
    }
    html.io-black-mode .bh-card:hover { border-color: hsl(216deg 3% 66% / 50%); }
    html.io-black-mode .bh-card.expired:hover { border-color: var(--bh-line); box-shadow: none; }
    html.io-black-mode .type-range { background: rgba(var(--bh-theme-rgb), .18); color: #ffc86b; }
    html.io-black-mode .bh-card.expired .bh-card__country,
    html.io-black-mode .bh-card.expired .bh-card__time { color: #6e7183; }
    html.io-black-mode .bh-flash.success { background: #166534; }
    html.io-black-mode .bh-flash.error { background: #991b1b; }
    html.io-black-mode .form-group input[type="date"] { color-scheme: dark; }
