:root {
    --ink: #261913;
    --muted: #796457;
    --paper: #fffaf3;
    --cream: #fff1dd;
    --line: #ead8c3;
    --accent: #d9480f;
    --accent-2: #0f766e;
    --gold: #f4a62a;
    --danger: #b42318;
    --ok: #15803d;
    --shadow: 0 22px 70px rgba(77, 39, 13, .16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(120deg, rgba(255, 250, 243, .96), rgba(255, 241, 221, .90)),
        url("https://images.unsplash.com/photo-1555507036-ab1f4038808a?auto=format&fit=crop&w=1800&q=82") center / cover fixed;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
}

.login-view {
    display: grid;
    grid-template-columns: minmax(300px, 1.1fr) minmax(320px, .9fr);
    min-height: 100vh;
}

.login-art {
    background:
        linear-gradient(180deg, rgba(19, 11, 5, .12), rgba(19, 11, 5, .42)),
        url("https://images.unsplash.com/photo-1488477181946-6428a0291777?auto=format&fit=crop&w=1400&q=85") center / cover;
}

.login-card {
    align-self: center;
    width: min(440px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, .68);
    border-radius: 18px;
    background: rgba(255, 250, 243, .94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    line-height: .92;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 4px;
    font-size: 1.2rem;
}

.muted,
.section-title p,
.hero p,
.history p {
    color: var(--muted);
}

label {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    color: #54392b;
    font-size: .9rem;
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 13px;
    color: var(--ink);
    background: white;
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(217, 72, 15, .13);
}

.primary,
.ghost,
.qty-btn {
    border: 0;
    border-radius: 10px;
    min-height: 44px;
    font-weight: 900;
}

.primary {
    margin-top: 22px;
    padding: 0 20px;
    color: white;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    box-shadow: 0 14px 28px rgba(217, 72, 15, .24);
}

.wide {
    width: 100%;
}

.ghost {
    padding: 0 16px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.danger {
    color: var(--danger);
}

.message {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--danger);
    font-size: .9rem;
    font-weight: 800;
}

.message.ok {
    color: var(--ok);
}

.dashboard {
    width: min(1220px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 46px;
}

.hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    min-height: 300px;
    margin-bottom: 16px;
    padding: 28px;
    overflow: hidden;
    border-radius: 22px;
    color: white;
    background:
        linear-gradient(90deg, rgba(29, 18, 11, .82), rgba(29, 18, 11, .18)),
        url("https://images.unsplash.com/photo-1555244162-803834f70033?auto=format&fit=crop&w=1800&q=86") center / cover;
    box-shadow: var(--shadow);
}

.hero .eyebrow,
.hero p {
    color: #ffe9c5;
}

.hero h1 {
    max-width: 620px;
}

.hero p {
    max-width: 560px;
    margin-bottom: 0;
    font-weight: 700;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 10px;
}

.hero-stats span,
.toolbar,
.sale-panel,
.history,
.product-card {
    border: 1px solid rgba(255, 255, 255, .76);
    background: rgba(255, 250, 243, .92);
    box-shadow: 0 12px 34px rgba(77, 39, 13, .10);
    backdrop-filter: blur(14px);
}

.hero-stats span {
    display: grid;
    min-width: 142px;
    padding: 14px;
    border-radius: 14px;
    color: var(--ink);
    font-weight: 800;
}

.hero-stats strong {
    font-size: 2rem;
    color: var(--accent);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 14px;
}

.toolbar div {
    display: grid;
    margin-right: auto;
    color: var(--muted);
}

.toolbar strong {
    color: var(--ink);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
    gap: 18px;
    align-items: start;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 10px 0 12px;
}

.section-title p {
    margin-bottom: 0;
    text-align: right;
}

.compact {
    display: block;
}

.compact p {
    text-align: left;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.product-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    min-height: 138px;
    padding: 16px;
    border-radius: 14px;
}

.product-card.low {
    border-color: rgba(180, 35, 24, .36);
}

.product-meta {
    min-width: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-bottom: 12px;
    padding: 0 8px;
    border-radius: 999px;
    color: white;
    background: var(--accent-2);
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.tag.dulce {
    background: #be185d;
}

.product-card h3 {
    margin: 0 0 10px;
    font-size: 1.15rem;
}

.stock-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 800;
}

.stock-line strong {
    color: var(--ink);
    font-size: 1.65rem;
}

.adjust-btn {
    margin-top: 12px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0 10px;
    color: #5f4434;
    background: #fff;
    font-size: .78rem;
    font-weight: 900;
}

.bar {
    height: 9px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #ead8c3;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-2), var(--gold));
}

.qty-controls {
    display: grid;
    grid-template-columns: 42px 54px 42px;
    align-self: center;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    color: white;
    background: var(--ink);
    font-size: 1.1rem;
}

.qty-btn.minus {
    background: #6b4d3f;
}

.qty-value {
    display: grid;
    place-items: center;
    min-height: 44px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--line);
    font-weight: 900;
}

.sale-panel,
.history {
    padding: 16px;
    border-radius: 14px;
}

.sale-panel {
    position: sticky;
    top: 14px;
}

.cart-list,
.history-list {
    display: grid;
    gap: 8px;
}

.cart-empty,
.history-empty,
.cart-row,
.history-row {
    padding: 12px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--line);
}

.cart-row,
.history-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 800;
}

.cart-row span,
.history-row span {
    color: var(--muted);
    font-weight: 700;
}

.history {
    margin-top: 18px;
}

.history-row {
    display: grid;
}

.history-row time {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
}

@media (max-width: 900px) {
    .login-view,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .login-art {
        min-height: 32vh;
    }

    .hero,
    .toolbar,
    .section-title {
        display: grid;
    }

    .section-title p {
        text-align: left;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .sale-panel {
        position: static;
    }
}

@media (max-width: 560px) {
    .dashboard {
        width: min(100% - 18px, 1220px);
        padding-top: 9px;
    }

    .hero {
        min-height: 250px;
        padding: 20px;
        border-radius: 16px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .product-card {
        grid-template-columns: 1fr;
    }

    .qty-controls {
        justify-content: start;
    }
}
