/* =========================================================
   Tienda Made — tema rosa, navbar superior, tarjetas redondeadas
   ========================================================= */
:root {
    --pink:        #ff5c93;
    --pink-dark:   #e0407a;
    --pink-deep:   #b02c5c;
    --pink-light:  #ffe3ee;
    --pink-tint:   rgba(255, 92, 147, .10);
    --bg:          #fff6f9;
    --surface:     #ffffff;
    --surface-2:   #fff0f5;
    --border:      #ffd9e8;
    --border-2:    #ffc2dc;
    --ink:         #3a2233;
    --ink-soft:    #8a7480;
    --ink-faint:   #c3a9b5;
    --green:       #2fa876;
    --green-bg:    rgba(47,168,118,.12);
    --red:         #e0447a;
    --red-bg:      rgba(224,68,122,.10);
    --amber:       #c17a1f;
    --amber-bg:    rgba(193,122,31,.12);
    --radius:      22px;
    --radius-sm:   14px;
    --radius-pill: 999px;
    --shadow:      0 6px 24px rgba(224,64,122,.10);
    --shadow-lg:   0 26px 70px rgba(176,44,92,.28);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--pink-dark); text-decoration: none; }
.ic { width: 19px; height: 19px; display: inline-block; flex-shrink: 0; vertical-align: -4px; }

/* ---------- Barra superior ---------- */
.topnav {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    box-shadow: var(--shadow);
}
.topnav .brand {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.01em;
}
.topnav .brand .dot {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: grid; place-items: center;
    border: 2px solid rgba(255,255,255,.6);
}
.topnav .links {
    display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center;
    flex-wrap: wrap;
}
.topnav .links a {
    color: rgba(255,255,255,.85); font-weight: 600; font-size: 13.5px;
    padding: 9px 16px; border-radius: var(--radius-pill);
    display: flex; align-items: center; gap: 7px;
    transition: background .15s ease, color .15s ease;
}
.topnav .links a:hover { background: rgba(255,255,255,.16); color: #fff; }
.topnav .links a.active { background: #fff; color: var(--pink-dark); }
.topnav .user {
    display: flex; align-items: center; gap: 10px;
}
.topnav .user .name { color: #fff; font-weight: 700; font-size: 13px; text-align: right; }
.topnav .user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #fff; color: var(--pink-dark);
    display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.topnav .logout-btn {
    background: rgba(255,255,255,.18); color: #fff; border: none;
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    display: grid; place-items: center;
    transition: background .15s ease;
}
.topnav .logout-btn:hover { background: rgba(255,255,255,.32); }

/* ---------- Contenido ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 30px 24px 70px; }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px;
    margin-bottom: 24px;
}
.page-head h1 {
    font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -.02em; color: var(--pink-deep);
}
.page-head .sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }

/* ---------- Botones tipo pildora ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: var(--radius-pill); border: 2px solid transparent;
    font-size: 13.5px; font-weight: 700; cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
    font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-pink { background: var(--pink); color: #fff; }
.btn-pink:hover { background: var(--pink-dark); box-shadow: 0 10px 24px var(--pink-tint); }
.btn-outline { background: #fff; color: var(--pink-dark); border-color: var(--border-2); }
.btn-outline:hover { background: var(--pink-light); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: #fff; color: var(--red); border-color: rgba(224,68,122,.35); }
.btn-danger:hover { background: var(--red-bg); }
.btn-lg { padding: 15px 28px; font-size: 14.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 24px 26px; }
.section-title {
    font-size: 12.5px; font-weight: 800; margin: 0 0 16px; color: var(--pink-deep);
    text-transform: uppercase; letter-spacing: .07em;
    display: flex; align-items: center; gap: 8px;
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1.5fr 1fr; }

/* ---------- Panel de estadisticas ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 22px; 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: var(--pink-tint);
}
.stat-card .label {
    color: var(--ink-soft); font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; display: flex; align-items: center; gap: 7px; position: relative;
}
.stat-card .value {
    font-size: 27px; font-weight: 800; margin-top: 9px; color: var(--ink); position: relative;
}
.stat-card.warn .value { color: var(--amber); }
.stat-card.pink .value { color: var(--pink-dark); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid-table thead tr { background: var(--surface-2); }
table.grid-table th {
    text-align: left; font-weight: 800; color: var(--pink-deep); font-size: 10.5px;
    text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px;
}
table.grid-table td { padding: 13px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
table.grid-table tbody tr { transition: background .12s ease; }
table.grid-table tbody tr:hover { background: var(--pink-tint); }

.thumb {
    width: 44px; height: 44px; border-radius: 14px; object-fit: cover;
    border: 1px solid var(--border); background: var(--surface-2);
}
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 700;
}
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-amber { background: var(--amber-bg); color: var(--amber); }
.tag-red   { background: var(--red-bg); color: var(--red); }
.tag-pink  { background: var(--pink-tint); color: var(--pink-dark); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; color: var(--pink-deep); }
.field input, .field select, .field textarea {
    font-family: inherit; font-size: 14.5px; color: var(--ink);
    padding: 11px 15px; border-radius: var(--radius-sm);
    border: 2px solid var(--border); background: var(--surface);
    transition: border .12s ease, box-shadow .12s ease;
    width: 100%;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--pink);
    box-shadow: 0 0 0 4px var(--pink-tint);
}
.field .err { color: var(--red); font-size: 12px; font-weight: 700; }
.hint { color: var(--ink-soft); font-size: 12px; }

.dropzone {
    border: 2px dashed var(--border-2); border-radius: var(--radius-sm);
    padding: 22px; text-align: center; cursor: pointer; background: var(--surface-2);
    transition: border .12s ease, background .12s ease;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dropzone:hover { border-color: var(--pink); background: var(--pink-tint); }
.dropzone .preview { max-height: 130px; border-radius: var(--radius-sm); margin-top: 4px; display: none; }

/* ---------- Alertas ---------- */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 13.5px; font-weight: 700; border: 1px solid transparent;
}
.alert-ok  { background: var(--green-bg); color: var(--green); border-color: rgba(47,168,118,.25); }
.alert-bad { background: var(--red-bg); color: var(--red); border-color: rgba(224,68,122,.25); }

/* ---------- Login ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 20%, var(--pink-light), var(--bg) 55%);
    padding: 20px;
}
.auth-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border-radius: 28px; box-shadow: var(--shadow-lg); padding: 40px 34px;
    border: 1px solid var(--border);
}
.auth-card .logo-badge {
    width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    display: grid; place-items: center; color: #fff;
    box-shadow: 0 10px 26px var(--pink-tint);
}
.auth-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; color: var(--pink-deep); }
.auth-card .lead { color: var(--ink-soft); text-align: center; margin: 0 0 26px; font-size: 13px; }
.auth-card .field { margin-bottom: 16px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.pos-search { margin-bottom: 16px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.item-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    overflow: hidden; cursor: pointer; text-align: left;
    transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease;
}
.item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--pink); }
.item-card .photo { width: 100%; height: 100px; object-fit: cover; background: var(--surface-2); display: block; }
.item-card .body { padding: 10px 12px 12px; }
.item-card .name { font-weight: 700; font-size: 12.5px; line-height: 1.3; }
.item-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.item-card .price { font-weight: 800; color: var(--pink-dark); }
.item-card .stock { font-size: 10.5px; color: var(--ink-soft); }

.basket {
    position: sticky; top: 88px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.basket h3 {
    margin: 0; padding: 18px 20px; color: #fff;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    display: flex; align-items: center; gap: 8px;
}
.basket-items { max-height: 340px; overflow-y: auto; }
.basket-empty { text-align: center; color: var(--ink-soft); padding: 34px 20px; font-size: 13px; }
.basket-row { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--surface-2); }
.basket-row .bi-name { flex: 1; font-size: 12.5px; font-weight: 700; min-width: 0; }
.basket-row .bi-name small { display: block; color: var(--ink-soft); font-weight: 400; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-2);
    background: var(--surface); cursor: pointer; color: var(--pink-dark);
    display: grid; place-items: center; font-weight: 800;
}
.qty-ctrl button:hover { background: var(--pink-light); }
.qty-ctrl span { min-width: 16px; text-align: center; font-weight: 800; font-size: 12px; }
.basket-row .bi-sub { font-weight: 800; min-width: 58px; text-align: right; font-size: 12.5px; }
.basket-foot { padding: 18px 20px; border-top: 1px solid var(--border); }
.basket-foot .line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; }
.basket-foot .total {
    display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; color: var(--pink-deep);
    margin: 10px 0 16px; border-top: 2px dashed var(--border); padding-top: 12px;
}

/* ---------- Modal (ModalView de confirmacion) ---------- */
.modal-bg {
    position: fixed; inset: 0; background: rgba(58,34,51,.55);
    display: none; place-items: flex-end center; z-index: 100; padding: 0;
}
.modal-bg.open { display: grid; animation: fadeIn .18s ease; }
.modal-box {
    width: 100%; max-width: 460px; background: var(--surface);
    border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg); overflow: hidden;
    animation: slideUp .28s cubic-bezier(.2, 1, .3, 1);
    margin-top: auto;
}
@media (min-width: 640px) {
    .modal-bg { place-items: center; }
    .modal-box { border-radius: 28px; margin-top: 0; }
}
.modal-head {
    padding: 24px 26px; color: #fff;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    display: flex; align-items: center; gap: 12px;
}
.modal-head .badge {
    width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.25);
    display: grid; place-items: center; flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-head p { margin: 2px 0 0; color: rgba(255,255,255,.85); font-size: 12px; }
.modal-body { padding: 22px 26px; }
.modal-summary { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px 17px; }
.modal-summary .line { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--ink-soft); }
.modal-summary .line.total {
    font-size: 17px; font-weight: 800; color: var(--pink-deep);
    border-top: 2px dashed var(--border); margin-top: 8px; padding-top: 10px;
}
.modal-foot { display: flex; gap: 10px; padding: 0 26px 26px; }
.modal-foot .btn { flex: 1; justify-content: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

.page { animation: popIn .25s ease; }

/* ---------- Ticket ---------- */
.receipt { max-width: 400px; margin: 0 auto; }
.receipt .head { text-align: center; padding: 26px; color: #fff; background: linear-gradient(135deg, var(--pink), var(--pink-dark)); border-radius: var(--radius) var(--radius) 0 0; }
.receipt .head .muted { color: rgba(255,255,255,.8) !important; }
.receipt .rows { padding: 20px 24px; background: var(--surface); }
.receipt .rows .r { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.receipt .foot { padding: 18px 24px; border-top: 2px dashed var(--border); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Utilidades ---------- */
.flex { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 12px; }
.mt { margin-top: 18px; }
.muted { color: var(--ink-soft); }
.right { text-align: right; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state .ic { width: 40px; height: 40px; opacity: .4; }

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .pos { grid-template-columns: 1fr; }
    .basket { position: static; }
    .form-grid { grid-template-columns: 1fr; }
    .topnav .links { display: none; }
}


/* ---------- Extras de autenticación (2 pasos / registro / recuperar) ---------- */
.auth-alt { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 18px 0 0; }
.auth-alt a { font-weight: 800; }
.code-input {
    text-align: center; font-size: 26px !important; font-weight: 800;
    letter-spacing: .35em; font-family: Consolas, monospace;
}