
:root {
    --bg: #f3f4f6;
    --ink: #222831;
    --muted: #747d89;
    --gold: #bd9148;
    --gold-dark: #98702f;
    --nav: #20252d;
    --line: #e5e7eb;
    --white: #ffffff;
    --danger: #a43d2c;
    --success: #28623c;
}

/* GLOBAL */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 Arial, sans-serif;
}

a {
    color: var(--gold-dark);
}

button,
input,
select,
textarea {
    font: inherit;
}

/* HEADER */
.top {
    min-height: 64px;
    background: #171b21;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

.brand {
    color: white;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
}

.brand b,
.gold {
    color: var(--gold);
}

.top a:not(.brand) {
    color: white;
    text-decoration: none;
}

/* MAIN LAYOUT */
.layout {
    min-height: calc(100vh - 112px);
    display: flex;
}

nav {
    width: 225px;
    background: var(--nav);
    padding: 22px 13px;
    flex-shrink: 0;
}

nav small {
    display: block;
    color: #9ca3af;
    font-size: 10px;
    letter-spacing: 1px;
    margin: 12px;
}

nav a {
    display: block;
    color: #e1e5ea;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 7px;
    margin-bottom: 3px;
    transition: 0.2s;
}

nav a:hover {
    background: #353d48;
    color: white;
}

nav .disabled {
    opacity: 0.48;
}

main {
    width: 100%;
    max-width: 1500px;
    padding: 30px;
    margin: 0 auto;
}

/* PAGE HEADING */
.heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.heading h1 {
    margin: 0;
    font-size: 29px;
}

.heading p {
    color: var(--muted);
}

/* BUTTONS */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #222831;
    color: white !important;
    text-decoration: none;
    border: 0;
    border-radius: 7px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.button:hover {
    background: var(--gold-dark);
}

.button.secondary {
    background: #e9edf2;
    color: #29313b !important;
}

.button.secondary:hover {
    background: #dce1e8;
}

/* DASHBOARD CARDS */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 22px 0;
}

.cards article,
.panel,
.login {
    background: white;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.025);
}

.cards small {
    color: var(--muted);
}

.cards strong {
    display: block;
    font-size: 29px;
    margin: 7px 0;
}

.cards p {
    color: var(--muted);
    font-size: 12px;
}

/* PANELS */
.panel {
    margin-bottom: 18px;
}

.panel h2 {
    margin-top: 0;
    font-size: 19px;
}

.panel h3 {
    font-size: 15px;
    margin-top: 22px;
}

/* NOTIFICATIONS */
.notice {
    background: #fff6e6;
    border-left: 3px solid var(--gold);
    padding: 12px;
    margin: 12px 0;
    border-radius: 5px;
}

.error {
    background: #fde9e9;
    color: #963333;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
}

.pill {
    background: #e5f4e9;
    color: var(--success);
    padding: 7px 12px;
    border-radius: 25px;
}

/* LOGIN */
.login {
    width: min(430px, calc(100% - 30px));
    margin: 55px auto;
    padding: 30px;
}

.login h1 {
    margin: 5px 0;
}

.login label {
    display: block;
    font-weight: bold;
    margin: 14px 0 5px;
}

.login input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d5d9df;
    border-radius: 6px;
}

.login button {
    width: 100%;
    margin-top: 20px;
}

.login small {
    display: block;
    margin-top: 17px;
    color: var(--muted);
}

/* ADVANCED STOCK MANAGEMENT */
.stock-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
    gap: 16px;
    margin: 18px 0;
}

/* PRODUCT FORMS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.form-grid label,
.stack label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 13px;
}

.form-grid input,
.form-grid select,
.stack input,
.stack textarea,
.stack select,
.search input {
    width: 100%;
    min-width: 0;
    padding: 11px;
    border: 1px solid #d5d9df;
    border-radius: 7px;
    font: inherit;
    background: white;
    color: var(--ink);
    outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.stack input:focus,
.stack textarea:focus,
.search input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(189,145,72,0.12);
}

.stack {
    display: grid;
    gap: 13px;
}

.check {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}

.check input {
    width: auto;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    grid-column: 1 / -1;
}

/* PRODUCT IMAGE UPLOAD */
.image-upload {
    grid-column: 1 / -1;
    font-weight: 700;
}

.image-preview-box {
    width: 100%;
    max-width: 300px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 10px;
    box-sizing: border-box;
}

.image-preview-box:hover {
    border-color: var(--gold-dark);
    background: #fffaf0;
}

.image-preview-box img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.image-preview-box span {
    font-size: 38px;
}

.image-preview-box p {
    color: var(--muted);
    font-size: 12px;
    margin: 5px 0;
}

.image-upload input[type="file"] {
    display: block;
    width: 100%;
    max-width: 350px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    margin: 8px 0;
}

.image-upload small {
    color: var(--muted);
    font-size: 12px;
}

.product-preview {
    display: block;
    width: 110px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    margin-top: 10px;
    border: 1px solid var(--line);
}

/* PRODUCT CATEGORIES */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chips span {
    background: #f1f3f5;
    padding: 6px 11px;
    border-radius: 20px;
    font-size: 12px;
}

/* SEARCH */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.search {
    display: flex;
    gap: 7px;
    max-width: 390px;
}

/* PRODUCT TABLE */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    text-align: left;
    padding: 12px 9px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th {
    color: #697381;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #fafafa;
}

tbody tr:hover {
    background: #fcfaf6;
}

td small {
    display: block;
    color: var(--muted);
}

td a {
    color: var(--gold-dark);
    font-weight: 600;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.product-thumb {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 9px;
    display: block;
    border: 1px solid var(--line);
}

.no-product-image {
    display: inline-flex;
    width: 55px;
    height: 55px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f1f2f4;
    color: #888;
}

/* STOCK STATUS */
.status-low,
.status-ok {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 5px;
    font-weight: bold;
}

.status-low {
    background: #fff0ed;
    color: var(--danger);
}

.status-ok {
    background: #eaf5ed;
    color: var(--success);
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

/* FOOTER */
footer {
    text-align: center;
    color: #9299a3;
    font-size: 12px;
    padding: 18px;
}

/* TABLET */
@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* MOBILE */
@media (max-width: 600px) {
    .layout {
        display: block;
    }

    nav {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 7px;
    }

    nav small {
        display: none;
    }

    nav a {
        white-space: nowrap;
        font-size: 12px;
    }

    main {
        padding: 17px;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .heading {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .heading h1 {
        font-size: 24px;
    }

    .top {
        padding: 0 14px;
    }

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

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .search {
        max-width: none;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .image-preview-box {
        width: 100%;
        max-width: 220px;
    }

    .product-thumb,
    .no-product-image {
        width: 44px;
        height: 44px;
    }

    .cards article {
        padding: 13px;
    }

    .cards strong {
        font-size: 22px;
    }
}
