/* ============================================================
   向日葵 Sunflower 设计系统
   主题：暖金 + 深板岩，柔和圆角卡片，轻盈阴影
   ============================================================ */
:root {
    --sf-gold: #f59e0b;
    --sf-gold-deep: #d97706;
    --sf-gold-soft: #fef3c7;
    --sf-ink: #1e293b;
    --sf-slate: #64748b;
    --sf-bg: #f4f6fb;
    --sf-card: #ffffff;
    --sf-border: #e6eaf2;
    --sf-radius: 14px;
    --sf-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
    --sf-shadow-lg: 0 8px 30px rgba(15, 23, 42, .12);
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Tahoma, sans-serif;
    background-color: var(--sf-bg);
    color: var(--sf-ink);
}

.sf-container {
    max-width: 1440px;
}

.sf-page {
    padding-top: 24px;
    padding-bottom: 40px;
}

/* ---------- 顶部导航 ---------- */
.sf-navbar {
    background: linear-gradient(120deg, #0f172a 0%, #1e293b 60%, #273549 100%);
    padding: .65rem 0;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .25);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.sf-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: .55rem;
    letter-spacing: .5px;
}

.sf-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 1.15rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 2px 8px rgba(245, 158, 11, .45);
}

.sf-user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .8rem .3rem .35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #e2e8f0;
    font-size: .85rem;
}

.sf-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    color: #451a03;
    background: linear-gradient(135deg, #fde68a, #f59e0b);
}

.sf-user-role {
    font-size: .72rem;
    color: #fbbf24;
    border-left: 1px solid rgba(255, 255, 255, .18);
    padding-left: .5rem;
}

.sf-btn-ghost {
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    font-size: .85rem;
    border-radius: 10px;
    padding: .35rem .9rem;
    transition: all .15s ease;
}

.sf-btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .3);
}

/* ---------- 统计卡片 ---------- */
.stat-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--sf-card);
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    padding: .95rem 1.05rem;
    box-shadow: var(--sf-shadow);
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
}

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

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 12px;
    font-size: 1.25rem;
    background: var(--sc-soft, #f1f5f9);
}

.stat-label {
    font-size: .75rem;
    color: var(--sf-slate);
    letter-spacing: .3px;
    margin-bottom: .1rem;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--sf-ink);
    font-variant-numeric: tabular-nums;
}

.stat-value-sm {
    font-size: 1.1rem;
}

.sc-indigo  { --sc-soft: #e0e7ff; }
.sc-emerald { --sc-soft: #d1fae5; }
.sc-sky     { --sc-soft: #e0f2fe; }
.sc-rose    { --sc-soft: #ffe4e6; }
.sc-amber   { --sc-soft: #fef3c7; }
.sc-slate   { --sc-soft: #e2e8f0; }

/* ---------- 卡片 ---------- */
.card.sf-card {
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    background: var(--sf-card);
}

.sf-card-header,
.card.sf-card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--sf-border);
    border-radius: var(--sf-radius) var(--sf-radius) 0 0 !important;
    padding: .9rem 1.25rem;
}

.sf-section-title {
    font-size: 1rem;
    font-weight: 650;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.sf-section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

.sf-subsection-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--sf-ink);
}

/* ---------- 按钮 ---------- */
.sf-btn-primary {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    padding: .45rem 1.15rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, .35);
    transition: all .15s ease;
}

.sf-btn-primary:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, .45);
    transform: translateY(-1px);
}

.sf-btn-outline {
    background: #fff;
    border: 1px solid var(--sf-border);
    color: var(--sf-ink);
    font-weight: 500;
    border-radius: 10px;
    padding: .45rem 1.15rem;
    transition: all .15s ease;
}

.sf-btn-outline:hover {
    border-color: var(--sf-gold);
    color: var(--sf-gold-deep);
    background: var(--sf-gold-soft);
}

.sf-btn-sm {
    padding: .28rem .85rem;
    font-size: .85rem;
}

/* ---------- 表格 ---------- */
.sf-table-wrap {
    max-height: 480px;
    overflow: auto;
    border-radius: 10px;
    border: 1px solid var(--sf-border);
}

.sf-table {
    margin-bottom: 0;
    font-size: .885rem;
}

.sf-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    border-bottom: 1px solid var(--sf-border);
    border-top: none;
    color: var(--sf-slate);
    font-size: .74rem;
    font-weight: 650;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: .65rem .85rem;
    white-space: nowrap;
}

.sf-table tbody td {
    padding: .62rem .85rem;
    vertical-align: middle;
    border-color: #f1f5f9;
    color: #334155;
}

.sf-table tbody tr {
    transition: background-color .12s ease;
}

.sf-table tbody tr:hover {
    background-color: #fdf8ec;
}

.logs-table {
    font-size: .84rem;
}

/* ---------- 徽章 ---------- */
.badge {
    font-weight: 550;
    padding: .32em .7em;
    border-radius: 999px;
}

.badge-on {
    background: #dcfce7;
    color: #15803d;
}

.badge-off {
    background: #e2e8f0;
    color: #475569;
}

.badge-err {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-admin {
    background: var(--sf-gold-soft);
    color: #b45309;
}

.badge-user {
    background: #e0e7ff;
    color: #4338ca;
}

.sf-self-tag {
    display: inline-block;
    font-size: .68rem;
    padding: .1em .5em;
    border-radius: 999px;
    background: var(--sf-gold-soft);
    color: #b45309;
    vertical-align: middle;
}

/* ---------- 表格内操作按钮组 ---------- */
.btn-group-xs {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

.btn-group-xs .btn {
    flex: none;
    padding: .22rem .6rem;
    font-size: .76rem;
    border-radius: 8px;
}

/* ---------- 表单与模态框 ---------- */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: var(--sf-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--sf-border);
    padding: 1rem 1.4rem;
}

.modal-title {
    font-weight: 650;
    font-size: 1.02rem;
}

.modal-body {
    padding: 1.25rem 1.4rem;
}

.modal-footer {
    border-top: 1px solid var(--sf-border);
    padding: .9rem 1.4rem;
}

.modal-xl {
    max-width: 90%;
}

.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--sf-border);
    font-size: .9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--sf-gold);
    box-shadow: 0 0 0 .22rem rgba(245, 158, 11, .16);
}

.form-label {
    font-size: .84rem;
    font-weight: 550;
    color: #475569;
}

.form-check-input:checked {
    background-color: var(--sf-gold);
    border-color: var(--sf-gold);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .22rem rgba(245, 158, 11, .16);
    border-color: #fcd34d;
}

/* ---------- Toast ---------- */
.toast {
    border: none;
    border-radius: 12px;
    box-shadow: var(--sf-shadow-lg);
}

.toast-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* ---------- 滚动条 ---------- */
.sf-table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sf-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sf-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- 加载状态 ---------- */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
    }

    .sf-table th, .sf-table td {
        padding: 0.5rem;
        font-size: .85rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}
