:root {
    --bg: #070707;
    --surface: #101010;
    --surface-2: #151515;
    --border: rgba(212, 174, 85, 0.18);

    --gold: #c9a44d;
    --gold-light: #e2c875;

    --text: #f5f5f5;
    --muted: #929292;

    --danger: #d65c5c;
    --success: #66b98a;

    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at top right,
            rgba(201, 164, 77, 0.08),
            transparent 35%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* =========================================================
   LOGIN
========================================================= */

.login-screen {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;
}

.login-card {
    width: min(430px, 100%);

    background: rgba(16, 16, 16, 0.94);

    border: 1px solid var(--border);

    border-radius: 24px;

    padding: 34px;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-mark {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    background: linear-gradient(
        145deg,
        var(--gold-light),
        var(--gold)
    );

    color: #080808;

    font-size: 24px;
    font-weight: 900;
}

.brand h1,
.brand strong {
    margin: 0;

    letter-spacing: 4px;

    font-size: 19px;
}

.brand span {
    display: block;

    margin-top: 3px;

    color: var(--gold);

    font-size: 9px;

    letter-spacing: 3px;
}

.login-subtitle {
    color: var(--muted);

    margin: 30px 0 22px;
}

label {
    display: block;

    margin: 17px 0 8px;

    font-size: 13px;
    font-weight: 600;
}

input {
    width: 100%;

    border: 1px solid #292929;

    border-radius: 12px;

    background: #0b0b0b;

    color: var(--text);

    padding: 14px 15px;

    outline: none;

    transition:
        border-color .2s,
        box-shadow .2s;
}

input:focus {
    border-color: var(--gold);

    box-shadow:
        0 0 0 3px rgba(201, 164, 77, 0.10);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 65px;
}

.password-toggle {
    position: absolute;

    right: 8px;
    top: 50%;

    transform: translateY(-50%);

    border: 0;

    background: transparent;

    color: var(--gold);

    font-size: 12px;
}

.remember {
    display: flex;

    align-items: center;

    gap: 9px;

    margin: 17px 0;

    color: var(--muted);

    cursor: pointer;
}

.remember input {
    width: 17px;
    height: 17px;

    accent-color: var(--gold);
}

.primary-button,
.secondary-button,
.logout-button {
    border-radius: 12px;

    padding: 13px 18px;

    font-weight: 700;

    border: 1px solid transparent;

    transition:
        transform .15s,
        opacity .15s,
        background .15s;
}

.primary-button {
    background: linear-gradient(
        135deg,
        var(--gold-light),
        var(--gold)
    );

    color: #080808;
}

.primary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.login-card .primary-button {
    width: 100%;

    margin-top: 8px;
}

.secondary-button {
    background: transparent;

    border-color: #303030;

    color: var(--text);
}

.message {
    min-height: 20px;

    margin: 14px 0 0;

    font-size: 13px;

    color: var(--danger);
}


/* =========================================================
   APP
========================================================= */

.topbar {
    min-height: 76px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 15px max(22px, 4vw);

    border-bottom: 1px solid #1d1d1d;

    background: rgba(7, 7, 7, 0.85);

    backdrop-filter: blur(16px);

    position: sticky;
    top: 0;
    z-index: 20;
}

.brand-small .brand-mark {
    width: 39px;
    height: 39px;

    font-size: 19px;

    border-radius: 11px;
}

.brand-small strong {
    font-size: 15px;
}

.brand-small span {
    font-size: 7px;
}

.logout-button {
    background: #121212;

    color: var(--muted);

    border-color: #282828;
}

.logout-button:hover {
    color: var(--text);
}

.dashboard {
    width: min(1250px, calc(100% - 40px));

    margin: 0 auto;

    padding: 42px 0 70px;
}

.welcome-row {
    display: flex;

    align-items: end;

    justify-content: space-between;

    gap: 25px;

    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 7px;

    color: var(--gold);

    font-size: 10px;

    font-weight: 800;

    letter-spacing: 2.5px;
}

h2,
h3 {
    margin: 0;
}

h2 {
    font-size: clamp(27px, 4vw, 40px);

    letter-spacing: -1px;
}

.muted {
    color: var(--muted);

    margin: 9px 0 0;

    font-size: 14px;
}

.add-button {
    white-space: nowrap;
}


/* =========================================================
   STATS
========================================================= */

.stats {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 13px;

    margin-bottom: 25px;
}

.stat-card {
    padding: 20px;

    border-radius: var(--radius);

    background: linear-gradient(
        145deg,
        #141414,
        #0d0d0d
    );

    border: 1px solid #242424;
}

.stat-card span {
    display: block;

    color: var(--muted);

    font-size: 12px;

    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 26px;
}

.warning-card strong {
    color: var(--danger);
}


/* =========================================================
   SEARCH
========================================================= */

.toolbar {
    margin-bottom: 28px;
}

.search-box {
    position: relative;
}

.search-box > span {
    position: absolute;

    left: 15px;
    top: 50%;

    transform: translateY(-50%);

    color: var(--gold);

    font-size: 21px;
}

.search-box input {
    padding-left: 45px;
}


/* =========================================================
   RESTOCK
========================================================= */

.restock-section {
    margin-bottom: 30px;

    padding: 20px;

    border-radius: var(--radius);

    border: 1px solid rgba(214, 92, 92, .2);

    background: rgba(214, 92, 92, .045);
}

.restock-section h3 {
    margin-bottom: 17px;
}

#restockList {
    display: flex;

    flex-wrap: wrap;

    gap: 9px;
}

.restock-item {
    display: inline-flex;

    align-items: center;

    gap: 9px;

    padding: 9px 12px;

    border-radius: 10px;

    background: #151515;

    border: 1px solid #2a2a2a;

    font-size: 13px;
}

.restock-item strong {
    color: var(--danger);
}


/* =========================================================
   INVENTORY
========================================================= */

.section-title {
    display: flex;

    align-items: end;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 17px;
}

.section-title > span {
    color: var(--muted);

    font-size: 12px;
}

.inventory-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;
}

.product-card {
    padding: 19px;

    border-radius: var(--radius);

    background: #101010;

    border: 1px solid #242424;

    min-width: 0;
}

.product-top {
    display: flex;

    justify-content: space-between;

    align-items: start;

    gap: 12px;

    margin-bottom: 20px;
}

.product-name {
    margin: 0;

    font-size: 16px;

    line-height: 1.3;

    overflow-wrap: anywhere;
}

.stock-badge {
    flex-shrink: 0;

    padding: 5px 8px;

    border-radius: 999px;

    font-size: 10px;

    font-weight: 800;

    background: rgba(102, 185, 138, .10);

    color: var(--success);
}

.stock-badge.empty {
    background: rgba(214, 92, 92, .10);

    color: var(--danger);
}

.product-info {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-bottom: 18px;
}

.info-box {
    padding: 11px;

    background: #0b0b0b;

    border-radius: 10px;
}

.info-box span {
    display: block;

    color: var(--muted);

    font-size: 10px;

    margin-bottom: 5px;
}

.info-box strong {
    font-size: 14px;
}

.quantity-control {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 8px;

    margin-bottom: 12px;
}

.quantity-control button {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    border: 1px solid #292929;

    background: #151515;

    color: var(--text);

    font-size: 18px;
}

.quantity-control button:hover {
    border-color: var(--gold);
}

.quantity-number {
    font-size: 15px;

    font-weight: 800;
}

.product-actions {
    display: flex;

    gap: 8px;
}

.product-actions button {
    flex: 1;

    border-radius: 10px;

    padding: 10px;

    border: 1px solid #292929;

    background: #151515;

    color: var(--text);

    font-size: 12px;

    font-weight: 700;
}

.product-actions button:hover {
    border-color: var(--gold);
}

.product-actions .delete-button:hover {
    border-color: var(--danger);

    color: var(--danger);
}

.buy-button {
    width: 100%;

    margin-top: 12px;

    padding: 10px;

    border-radius: 10px;

    border: 1px solid rgba(214, 92, 92, .3);

    background: rgba(214, 92, 92, .08);

    color: var(--danger);

    font-size: 12px;

    font-weight: 800;
}


/* =========================================================
   EMPTY
========================================================= */

.empty-state {
    text-align: center;

    padding: 70px 20px;

    border: 1px dashed #292929;

    border-radius: var(--radius);
}

.empty-icon {
    width: 54px;
    height: 54px;

    display: grid;
    place-items: center;

    margin: 0 auto 15px;

    border-radius: 16px;

    background: rgba(201, 164, 77, .10);

    color: var(--gold);

    font-weight: 900;

    font-size: 22px;
}

.empty-state p {
    color: var(--muted);

    font-size: 13px;
}


/* =========================================================
   MODAL
========================================================= */

.modal {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: grid;

    place-items: center;

    padding: 20px;
}

.modal-backdrop {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, .78);

    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;

    width: min(500px, 100%);

    max-height: 90vh;

    overflow: auto;

    padding: 25px;

    border-radius: 22px;

    background: #111;

    border: 1px solid var(--border);

    box-shadow:
        0 30px 90px rgba(0,0,0,.65);
}

.modal-header {
    display: flex;

    justify-content: space-between;

    align-items: start;

    gap: 20px;

    margin-bottom: 20px;
}

.close-button {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    border: 1px solid #292929;

    background: #151515;

    color: var(--text);

    font-size: 22px;
}

.modal-actions {
    display: flex;

    gap: 10px;

    margin-top: 25px;
}

.modal-actions button {
    flex: 1;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 950px) {

    .inventory-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 650px) {

    .dashboard {
        width: min(100% - 24px, 600px);

        padding-top: 28px;
    }

    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .welcome-row {
        align-items: stretch;

        flex-direction: column;
    }

    .add-button {
        width: 100%;
    }

    .inventory-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card strong {
        font-size: 21px;
    }

    .brand-small strong {
        font-size: 13px;
    }

    .logout-button {
        padding: 10px 12px;
    }

    .login-card {
        padding: 25px 20px;
    }
}


@media (max-width: 390px) {

    .stats {
        grid-template-columns: 1fr;
    }

    .section-title {
        align-items: start;

        flex-direction: column;
    }
}