<div class="page-head">
    <div><h1>分类管理</h1><div class="desc">产品系列分类</div></div>
    <a class="btn-primary" href="<?php echo site_url('admin/categories/create'); ?>">+ 新增分类</a>
</div>
<div class="admin-card">
    <table class="admin-table">
        <tr><th>图标</th><th>名称</th><th>标识</th><th>模式</th><th>描述</th><th>操作</th></tr>
        <?php foreach ($cats as $c): ?>
            <?php $cm = empty($c['mode']) ? 'fixed' : $c['mode']; ?>
            <tr>
                <td style="font-size:24px"><?php echo e($c['icon']); ?></td>
                <td><b><?php echo e($c['name']); ?></b></td>
                <td class="muted"><?php echo e($c['slug']); ?></td>
                <td><span class="mode-badge <?php echo $cm === 'builder' ? 'builder' : 'fixed'; ?>"><?php echo $cm === 'builder' ? '可视化' : '固定'; ?></span></td>
                <td class="muted"><?php echo e(mb_substr($c['description'] ?? '', 0, 24)); ?></td>
                <td>
                    <div class="row-actions">
                        <a class="btn-soft btn-sm" href="<?php echo site_url('admin/categories/edit/' . $c['id']); ?>">编辑</a>
                        <form class="del-form" method="post" action="<?php echo site_url('admin/categories/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>
