:root {
    --primary: #2563eb;
    --store-color: #2563eb;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --danger: #dc2626;
    --success: #16a34a;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.2; }

/* ---- Admin ---- */
.admin-nav {
    display: flex; justify-content: space-between; align-items: center;
    background: #111827; color: #fff; padding: 14px 24px;
}
.admin-nav-brand { font-weight: 700; font-size: 18px; }
.admin-nav-links a { color: #d1d5db; margin-left: 18px; font-size: 14px; }
.admin-nav-links a:hover { color: #fff; }
.admin-main { max-width: 960px; margin: 0 auto; padding: 32px 20px; }

.auth-card, .card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 28px; margin-bottom: 24px;
}
.card.highlight { border-color: var(--primary); background: #eff6ff; }
.auth-card { max-width: 420px; margin: 40px auto; }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; font-family: inherit;
}
input[type=color] { padding: 4px; height: 42px; }
textarea { resize: vertical; }

.btn {
    display: inline-block; padding: 10px 18px; border-radius: 6px; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-link { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0; font-size: 13px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; text-align: center; }
.stat-number { display: block; font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; }

.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }

.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-pagado { background: #dcfce7; color: #166534; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

.image-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.image-thumb { position: relative; width: 90px; height: 90px; }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.image-thumb a { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.preview-sm { max-width: 120px; display: block; margin-top: 8px; border-radius: 6px; }

.order-block { border-bottom: 1px solid var(--border); padding: 16px 0; }
.order-header { display: flex; justify-content: space-between; align-items: start; }
.order-items { margin: 8px 0; padding-left: 18px; font-size: 14px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; }

/* ---- Tienda pública ---- */
.store-header { background: #fff; border-bottom: 1px solid var(--border); }
.store-header-inner { max-width: 1100px; margin: 0 auto; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.store-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--text); }
.store-brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.cart-link { font-weight: 600; color: var(--text); }
.store-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.store-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }
.store-banner img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 10px; }
.store-intro { margin: 20px 0; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; margin-top: 20px; }
.product-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; color: var(--text); display: block; }
.product-card:hover { border-color: var(--store-color, var(--primary)); text-decoration: none; }
.product-thumb { aspect-ratio: 1; background: #f3f4f6; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 13px; }
.thumb-placeholder.large { aspect-ratio: 1; }
.product-info { padding: 12px; }
.product-info h3 { font-size: 15px; margin: 0 0 6px; }
.price { font-weight: 700; color: var(--store-color, var(--primary)); }
.tag { display: inline-block; background: #eef2ff; color: #4338ca; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.main-image { width: 100%; border-radius: 10px; object-fit: cover; aspect-ratio: 1; }
.thumb-row { display: flex; gap: 8px; margin-top: 10px; }
.thumb-small { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); }
.price-lg { font-size: 24px; font-weight: 700; color: var(--store-color, var(--primary)); }
.out-of-stock { color: var(--danger); font-weight: 600; }

.checkout-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.order-summary .summary-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.order-summary .total { font-weight: 700; font-size: 16px; border-bottom: none; }
.total-line { font-size: 18px; margin: 16px 0; }

@media (max-width: 720px) {
    .product-detail, .checkout-layout { grid-template-columns: 1fr; }
}
