/* 租户管理中心 —— 在 admin.css 设计令牌之上补充概览卡片、配额与报表样式 */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-grid-sm {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s, transform 0.18s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* 左侧语义色条：充值=主色，消耗=警示，剩余=成功，成员=中性 */
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent, var(--primary));
}

.stat-card.tone-recharge { --accent: var(--primary); }
.stat-card.tone-consumed { --accent: var(--warn); }
.stat-card.tone-balance  { --accent: var(--success); }
.stat-card.tone-neutral  { --accent: var(--text-2); }
.stat-card.tone-danger   { --accent: var(--danger); }

.stat-label {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-grid-sm .stat-value { font-size: 22px; }

.stat-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-left: 4px;
}

.stat-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-2);
}

/* ── 区块 ── */

.card-block {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.block-title {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.panel-hint {
    margin: -6px 0 18px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-2);
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
}

.quota-alert {
    margin-bottom: 22px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #92400e;
    background: var(--warn-bg);
    border-left: 3px solid var(--warn);
    border-radius: var(--radius-sm);
}

/* ── 纯 CSS 柱状趋势图（避免为一张图引入图表库） ── */

.trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 160px;
    padding-top: 8px;
}

.trend-bar {
    flex: 1;
    min-width: 4px;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--primary) 0%, #a5b4fc 100%);
    transition: filter 0.15s;
}

.trend-bar:hover { filter: brightness(1.15); }
.trend-bar.is-zero { background: var(--border); }

.trend-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    color: var(--text-2);
    font-size: 13px;
}

/* ── 角色与配额 ── */

.role-badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
}

.role-badge.role-admin { color: var(--primary); background: var(--primary-light); }
.role-badge.role-member { color: var(--text-2); background: var(--bg); }

.quota-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.quota-cell.unlimited { color: var(--text-2); }

.usage-triple {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--text-2);
}

.usage-triple strong { color: var(--text); font-weight: 600; }

/* 配额使用率进度条 */
.usage-bar {
    position: relative;
    width: 110px;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--success);
}

.usage-bar.warn span { background: var(--warn); }
.usage-bar.over span { background: var(--danger); }

.usage-pct {
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.usage-row { display: flex; align-items: center; }

/* ── 流水金额 ── */

.amount-pos { color: var(--success); font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }

.txn-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-2);
}

.txn-type.t-recharge { background: var(--success-bg); color: var(--success); }
.txn-type.t-usage { background: var(--warn-bg); color: #b45309; }

/* ── 模态框中的配额输入 ── */

.quota-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-note {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-2);
}

.form-error {
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--danger);
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
}

/* ── 租户 Logo（平台后台列表 + 上传弹窗） ── */

.tenant-logo-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-2);
    border: 1px solid var(--border);
}

.tenant-logo-thumb.placeholder {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-2);
    text-transform: uppercase;
}

.sidebar-logo-img {
    display: block;
    max-width: 100%;
    max-height: 32px;
    object-fit: contain;
}

.logo-current {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 220px;
    max-height: 90px;
    min-width: 120px;
    min-height: 64px;
    padding: 8px;
    border-radius: 10px;
    object-fit: contain;
    background: var(--bg-2);
    border: 1px dashed var(--border);
}

.logo-preview.placeholder {
    font-size: 13px;
    color: var(--text-2);
}

.modal-sep {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0 16px;
}

@media (max-width: 900px) {
    .quota-fields { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
