<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } ?> <div class="str-grid"><?php foreach ($stores as $s): $nick = $s['nickname'] ?? ''; $storeType = $s['store_type'] ?? 'replica'; ?> <div class="str-card"> <div class="str-accent" style="background:<?= htmlspecialchars($s['accent_color'] ?? '#2D6A4F') ?>"></div> <div class="str-info"><?php if ($nick): ?> <h3><?= htmlspecialchars($nick) ?></h3> <span class="str-enc-mask">Encrypted store content</span><?php else: ?> <h3>Store #<?= (int)$s['id'] ?></h3> <span class="str-enc-mask">No nickname -- set one in Manage</span><?php endif; ?> </div> <div> <div class="str-domain"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" style="opacity:.3;vertical-align:middle"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg> <span style="opacity:.3;font-size:11px">encrypted</span></div> <span class="str-type-pill"><?= htmlspecialchars($storeType) ?></span> </div> <div class="str-stat-col"><span class="str-stat-num cat"><?= $storeCatCounts[(int)$s['id']] ?? 0 ?></span><span class="str-stat-lbl">Categories</span></div> <div class="str-stat-col"><span class="str-stat-num prod"><?= $storeProdCounts[(int)$s['id']] ?? 0 ?></span><span class="str-stat-lbl">Products</span></div> <form method="POST" style="margin:0"><?= CSRF::field() ?> <input type="hidden" name="store_action" value="toggle"><input type="hidden" name="sid" value="<?= $s['id'] ?>"> <button type="submit" class="str-status" style="color:<?= $s['is_active'] ? '#2ecc71' : 'rgba(200,204,212,.4)' ?>"<?= $s['id'] == 1 ? 'disabled title="Master store"' : '' ?>><?= $s['is_active'] ? 'ACTIVE' : 'OFF' ?></button> </form> <div class="str-acts"> <a href="?view=store&id=<?= $s['id'] ?>&action=manage" class="str-manage-btn" title="Decrypt &amp; Manage Content"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>MANAGE</a> <a href="?view=stores&edit=<?= $s['id'] ?>" class="blk-act" title="Edit"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg></a><?php if ($s['id'] > 1): ?> <form method="POST" style="margin:0" data-confirm="Delete this store? Products and categories will be moved to inactive (not deleted)."><?= CSRF::field() ?> <input type="hidden" name="store_action" value="delete"><input type="hidden" name="sid" value="<?= $s['id'] ?>"> <button type="submit" class="blk-act blk-act-del"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg></button> </form><?php endif; ?> </div> </div><?php endforeach; ?> </div>