<div class="page-head">
    <div><h1>客户案例管理</h1><div class="desc">客户案例展示，可像新闻一样持续新增</div></div>
    <a class="btn-primary" href="<?php echo site_url('admin/cases/create'); ?>">+ 新增案例</a>
</div>
<div class="admin-card">
    <table class="admin-table">
        <tr><th>封面</th><th>案例标题</th><th>模式</th><th>客户</th><th>行业</th><th>日期</th><th>状态</th><th>操作</th></tr>
        <?php foreach ($cases as $c): ?>
            <?php $cm = empty($c['mode']) ? 'fixed' : $c['mode']; ?>
            <tr>
                <td><div class="thum" style="background:<?php echo gradient($c['id']); ?>">🤝</div></td>
                <td><b><?php echo e($c['title']); ?></b></td>
                <td><span class="mode-badge <?php echo $cm === 'builder' ? 'builder' : 'fixed'; ?>"><?php echo $cm === 'builder' ? '可视化' : '固定'; ?></span></td>
                <td class="muted"><?php echo e($c['customer'] ?? ''); ?></td>
                <td class="muted"><?php echo e($c['industry'] ?? ''); ?></td>
                <td class="muted"><?php echo e(format_date($c['published_at'])); ?></td>
                <td><?php echo ($c['status'] ?? 1) ? '<span class="tag-mini">展示中</span>' : '<span class="muted">隐藏</span>'; ?></td>
                <td>
                    <div class="row-actions">
                        <a class="btn-soft btn-sm" href="<?php echo site_url('admin/cases/edit/' . $c['id']); ?>">编辑</a>
                        <form class="del-form" method="post" action="<?php echo site_url('admin/cases/delete/' . $c['id']); ?>"><?php echo csrf_field(); ?><button class="btn-danger btn-sm" type="submit">删除</button></form>
                    </div>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>
</div>
<style>
.mode-badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600}
.mode-badge.fixed{background:#f1f5f9;color:#475569}
.mode-badge.builder{background:#ede9fe;color:#6d28d9}
</style>
