:root {
    --bg: #eef2f6;
    --panel: #ffffff;
    --sidebar: #f7f9fc;
    --sidebar-border: #e5eaf0;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #2563eb;
    --brand-soft: #dbeafe;
    --accent: #0f766e;
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 14px;
    --sidebar-width: 268px;
    --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 500px at 10% -10%, #dbeafe 0%, transparent 55%),
        radial-gradient(900px 400px at 100% 0%, #ccfbf1 0%, transparent 45%),
        var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #fbfdff 0%, var(--sidebar) 100%);
    border-right: 1px solid var(--sidebar-border);
    padding: 14px 12px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 16px;
}

.brand-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(145deg, #fb7185, #e11d48);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.28);
}

.brand h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.side-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 4px 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
}
.side-user strong { display: block; font-size: 13px; }
.side-user span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.cell-link {
    color: var(--brand);
    font-weight: 600;
    border-bottom: 1px dashed rgba(37, 99, 235, .35);
}
.cell-link:hover { color: #1d4ed8; }

.side-search {
    display: flex;
    gap: 8px;
    padding: 0 4px 14px;
}

.side-search input {
    flex: 1;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 9px 12px;
    outline: none;
}

.side-search input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.side-search .add-btn {
    width: 38px;
    border: none;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
}

.nav-item, .nav-folder-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #334155;
    margin-bottom: 4px;
}

.nav-item:hover, .nav-folder-title:hover {
    background: #eef2ff;
}

.nav-item.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.nav-item .dot-menu {
    margin-left: auto;
    opacity: 0.7;
}

.nav-icon {
    width: 18px;
    text-align: center;
    opacity: 0.9;
}

.nav-folder {
    margin-top: 6px;
}

.nav-folder-title {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}

.nav-folder-title .folder {
    color: #eab308;
}

.nav-folder-title .count {
    color: var(--muted);
    font-weight: 500;
}

.nav-folder-title .chev {
    margin-left: auto;
    transition: transform .2s ease;
    color: #94a3b8;
}

.nav-folder.open .nav-folder-title .chev {
    transform: rotate(180deg);
}

.nav-children {
    display: none;
    padding: 2px 0 8px 12px;
}

.nav-folder.open .nav-children {
    display: block;
}

.nav-children a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #475569;
    margin-bottom: 2px;
}

.nav-children a:hover {
    background: #f1f5f9;
}

.nav-children a.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.main {
    padding: 22px 26px 40px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.crumb {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.page-title {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.2px;
}

.page-desc {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: transparent;
    color: #fff;
}
.btn-ghost { background: transparent; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(15,118,110,.08));
}

.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat-foot { margin-top: 8px; font-size: 12px; color: var(--accent); }

.grid-2 {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head h3 {
    margin: 0;
    font-size: 16px;
}

.panel-body { padding: 0; }

.table-wrap { overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

th {
    color: #64748b;
    font-weight: 600;
    background: #f8fafc;
    position: sticky;
    top: 0;
}

tr:hover td { background: #f8fbff; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-ok { background: #d1fae5; color: #047857; }
.badge-warn { background: #ffedd5; color: #c2410c; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-muted { background: #f1f5f9; color: #64748b; }

.timeline {
    list-style: none;
    margin: 0;
    padding: 16px 18px 8px;
}

.timeline li {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 12px;
    padding-bottom: 16px;
}

.timeline .dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.timeline .meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.toolbar .filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar input, .toolbar select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    background: #fff;
    min-width: 160px;
}

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.demo-tip {
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
}

.form-alert {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}
.form-alert-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.form-alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.form-panel .panel-head a { color: var(--brand); font-size: 13px; }
.biz-form { padding: 18px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}
.form-item-full { grid-column: 1 / -1; }
.form-item label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}
.form-item .req { color: #dc2626; margin-left: 2px; }
.form-item .hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }
.form-item input,
.form-item select,
.form-item textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    background: #fff;
    outline: none;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.check-line {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
}
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.btn-danger {
    background: #fff;
    border-color: #fecaca;
    color: #b91c1c;
    margin-left: auto;
}
.btn-danger:hover { background: #fef2f2; }
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px;
}
.ops { white-space: nowrap; }

@media (max-width: 860px) {
    .form-grid { grid-template-columns: 1fr; }
}

.bars {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.bar-row { display: grid; grid-template-columns: 72px 1fr 40px; gap: 10px; align-items: center; }
.bar-track {
    height: 10px;
    background: #eef2ff;
    border-radius: 999px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #14b8a6);
}

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--sidebar-border);
    }
    .main { padding: 16px; }
}
