/* ── Fenbao Management System Styles ─────────────────────────────────────── */

:root {
    --fb-bg: #F3F4F6;
    --fb-surface: #FFFFFF;
    --fb-border: #E5E7EB;
    --fb-text: #111827;
    --fb-muted: #6B7280;
    --fb-accent: #2563EB;
    --fb-accent-light: #EFF6FF;
    --fb-green: #059669;
    --fb-green-light: #D1FAE5;
    --fb-red: #DC2626;
    --fb-red-light: #FEE2E2;
    --fb-yellow: #D97706;
    --fb-yellow-light: #FEF3C7;
    --fb-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --fb-shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --fb-radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--fb-bg);
    color: var(--fb-text);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.fb-topbar {
    background: linear-gradient(135deg, #0e1e3d 0%, #1a3975 100%);
    color: #fff;
    padding: 0 28px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.fb-topbar-left { display: flex; align-items: center; gap: 14px; }
.fb-topbar-right { display: flex; align-items: center; gap: 10px; }
.fb-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.fb-breadcrumb a { color: rgba(255,255,255,.55); text-decoration: none; transition: color .15s; }
.fb-breadcrumb a:hover { color: #fff; }
.fb-breadcrumb .sep { color: rgba(255,255,255,.3); font-size: .7rem; }
.fb-breadcrumb strong { color: #fff; font-weight: 700; }
.fb-user-info { font-size: .8rem; color: rgba(255,255,255,.65); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.fb-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px; font-size: .82rem;
    font-weight: 600; cursor: pointer; border: none; transition: .2s;
    text-decoration: none; white-space: nowrap;
}
.fb-btn-primary {
    background: var(--fb-accent); color: #fff;
}
.fb-btn-primary:hover { background: #1d4ed8; }
.fb-btn-ghost {
    background: rgba(255,255,255,.13);
    color: rgba(255,255,255,.85);
    border: 1px solid rgba(255,255,255,.22);
}
.fb-btn-ghost:hover { background: rgba(255,255,255,.22); }
.fb-btn-secondary {
    background: var(--fb-surface); color: var(--fb-text);
    border: 1px solid var(--fb-border);
}
.fb-btn-secondary:hover { background: #F9FAFB; }
.fb-btn-danger {
    background: var(--fb-red-light); color: var(--fb-red);
    border: 1px solid #FECACA;
}
.fb-btn-danger:hover { background: #FEE2E2; }
.fb-btn-sm { padding: 5px 10px; font-size: .78rem; }
.fb-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Shell & content ─────────────────────────────────────────────────────── */
.fb-shell { min-height: 100vh; }
.fb-content { max-width: 1320px; margin: 0 auto; padding: 24px 28px 72px; }

/* ── Section headers ─────────────────────────────────────────────────────── */
.fb-section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 18px;
}
.fb-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.1rem; font-weight: 800; margin: 0;
}
.fb-section-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, #EEF2FF, #DBEAFE);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--fb-accent); font-size: .85rem; flex-shrink: 0;
}
.fb-section-actions { display: flex; gap: 8px; align-items: center; }

/* ── Cards (project list) ────────────────────────────────────────────────── */
.fb-card-grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.fb-card-sm {
    background: #fff;
    border-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fb-card-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.08);
}
.fb-card-title-sm {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--fb-dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fb-card {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 20px 22px;
    box-shadow: var(--fb-shadow);
    cursor: pointer;
    transition: box-shadow .2s, transform .1s;
}
.fb-card:hover { box-shadow: var(--fb-shadow-md); transform: translateY(-1px); }
.fb-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.fb-card-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 4px; }
.fb-card-subtitle { font-size: .82rem; color: var(--fb-muted); line-height: 1.4; }
.fb-card-meta { display: flex; gap: 12px; margin-top: 12px; }
.fb-card-tag {
    font-size: .75rem; font-weight: 600; padding: 3px 10px;
    border-radius: 999px; display: inline-flex; align-items: center; gap: 4px;
}
.fb-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.fb-card-actions .fb-btn { padding: 5px 8px; font-size: .78rem; }

/* ── Status badge ────────────────────────────────────────────────────────── */
.fb-badge {
    font-size: .73rem; font-weight: 700; padding: 3px 10px;
    border-radius: 999px; display: inline-flex; align-items: center; gap: 4px;
}
.fb-badge.active { background: var(--fb-green-light); color: #065F46; }
.fb-badge.completed { background: #DBEAFE; color: #1E40AF; }
.fb-badge.stopped { background: var(--fb-red-light); color: #991B1B; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.fb-table-wrap {
    overflow: auto;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
}
.fb-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.fb-table th,
.fb-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--fb-border);
    text-align: left;
    vertical-align: middle;
    font-size: .83rem;
}
.fb-table th {
    color: var(--fb-muted);
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #F9FAFB;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.fb-table tr { cursor: pointer; transition: background .1s; }
.fb-table tbody tr:hover { background: #F9FAFB; }
.fb-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fb-table .actions { text-align: center; white-space: nowrap; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.fb-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--fb-border);
    margin-bottom: 20px;
}
.fb-tab {
    padding: 10px 20px; font-size: .88rem; font-weight: 600;
    color: var(--fb-muted); cursor: pointer; border: none; background: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .2s;
}
.fb-tab:hover { color: var(--fb-text); }
.fb-tab.active { color: var(--fb-accent); border-bottom-color: var(--fb-accent); }

/* ── KPI strip ───────────────────────────────────────────────────────────── */
.fb-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.fb-kpi {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 16px 18px;
    box-shadow: var(--fb-shadow);
}
.fb-kpi-label {
    font-size: .72rem; font-weight: 700; color: var(--fb-muted);
    letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px;
}
.fb-kpi-value {
    font-size: 1.7rem; font-weight: 800; color: var(--fb-text);
    line-height: 1; font-variant-numeric: tabular-nums;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.fb-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.fb-modal {
    background: var(--fb-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,.15);
}
.fb-modal.wide { max-width: 900px; }
.fb-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--fb-border);
}
.fb-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.fb-modal-close {
    background: none; border: none; font-size: 1.1rem;
    color: var(--fb-muted); cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.fb-modal-close:hover { background: #F3F4F6; color: var(--fb-text); }
.fb-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.fb-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--fb-border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.fb-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.fb-form-grid .full { grid-column: 1 / -1; }
.fb-field { display: flex; flex-direction: column; gap: 4px; }
.fb-field label {
    font-size: .78rem; font-weight: 700; color: var(--fb-muted);
}
.fb-field label .req { color: var(--fb-red); }
.fb-field input,
.fb-field select,
.fb-field textarea {
    padding: 8px 12px;
    border: 1px solid var(--fb-border);
    border-radius: 8px;
    font-size: .85rem;
    font-family: inherit;
    transition: border-color .15s;
    outline: none;
}
.fb-field input:focus,
.fb-field select:focus,
.fb-field textarea:focus {
    border-color: var(--fb-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── Match indicator ─────────────────────────────────────────────────────── */
.fb-match-exact { color: var(--fb-green); }
.fb-match-fuzzy { color: var(--fb-yellow); }
.fb-match-llm { color: #7C3AED; }
.fb-match-none { color: var(--fb-red); }

/* ── Empty state / placeholder ───────────────────────────────────────────── */
.fb-placeholder {
    color: var(--fb-muted); font-size: .85rem;
    padding: 40px 0; text-align: center;
}
.fb-empty-icon { font-size: 2rem; margin-bottom: 10px; opacity: .4; }

/* ── Alert / error ───────────────────────────────────────────────────────── */
.fb-alert {
    padding: 10px 14px; border-radius: 8px; font-size: .84rem; margin-bottom: 14px;
}
.fb-alert-error { background: var(--fb-red-light); color: var(--fb-red); border: 1px solid #FECACA; }
.fb-alert-success { background: var(--fb-green-light); color: #065F46; border: 1px solid #A7F3D0; }
.fb-alert-info { background: var(--fb-accent-light); color: var(--fb-accent); border: 1px solid #BFDBFE; }

/* ── File upload zone ────────────────────────────────────────────────────── */
.fb-upload-zone {
    border: 2px dashed var(--fb-border);
    border-radius: var(--fb-radius);
    padding: 30px;
    text-align: center;
    color: var(--fb-muted);
    cursor: pointer;
    transition: .2s;
}
.fb-upload-zone:hover,
.fb-upload-zone.dragover {
    border-color: var(--fb-accent);
    background: var(--fb-accent-light);
    color: var(--fb-accent);
}
.fb-upload-zone i { font-size: 1.5rem; margin-bottom: 8px; }

/* ── Inline edit input ───────────────────────────────────────────────────── */
.fb-inline-input {
    width: 90px; padding: 4px 8px; border: 1px solid var(--fb-border);
    border-radius: 6px; font-size: .83rem; text-align: right;
    font-family: inherit;
}
.fb-inline-input:focus { border-color: var(--fb-accent); outline: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .fb-content { padding: 16px 16px 56px; }
    .fb-topbar { padding: 0 16px; }
    .fb-card-grid { grid-template-columns: 1fr; }
    .fb-kpi-row { grid-template-columns: 1fr 1fr; }
    .fb-form-grid { grid-template-columns: 1fr; }
    .fb-user-info { display: none; }
    .fb-modal { max-width: 100%; margin: 10px; }
}
