:root {
    --blue: #0072AA;
    --red: #E21D38;
    --background: #242424;
    --card: #363636;
    --secondary: #414141;
    --white: #FEFEFE;
    --muted: #B3B3B3;
    --border: #505050;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--white);
    font-family: Inter, Arial, sans-serif;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 250px;
    background: var(--blue);
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.branding {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 35px;
}

.branding h2 {
    font-size: 19px;
    margin: 0;
    letter-spacing: 1px;
}

.branding span {
    font-size: 12px;
    color: rgba(255,255,255,.8);
}

.logo {
    width: 38px;
    height: 38px;
    display: flex;
    transform: rotate(45deg);
    border: 2px solid white;
    border-radius: 5px;
    overflow: hidden;
}

.logo-red,
.logo-blue {
    width: 50%;
    height: 100%;
}

.logo-red {
    background: var(--red);
}

.logo-blue {
    background: white;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border-radius: 7px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: background .2s;
}

.nav-item span {
    width: 20px;
    text-align: center;
    font-size: 17px;
}

.nav-item:hover {
    background: rgba(255,255,255,.13);
}

.nav-item.active {
    background: var(--red);
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.2);
    margin: 15px 5px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 10px 0;
    font-size: 12px;
    color: rgba(255,255,255,.8);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #7EE0A0;
    border-radius: 50%;
    margin-right: 7px;
}

/* Main content */

.main {
    flex: 1;
    min-width: 0;
    padding: 32px 38px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

h1 {
    margin: 0;
    font-size: 27px;
}

.topbar p,
.section-heading p,
.panel-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.store-selector {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 16px;
    min-width: 175px;
}

.store-selector span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.store-selector strong {
    font-size: 14px;
}

/* Welcome panel */

.welcome {
    background: linear-gradient(115deg, #0072AA, #00547D);
    border-radius: 12px;
    padding: 27px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    overflow: hidden;
}

.eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    opacity: .8;
}

.welcome h2 {
    font-size: 25px;
    margin: 10px 0 6px;
}

.welcome p {
    color: rgba(255,255,255,.8);
    margin: 0;
    font-size: 14px;
}

.welcome-icon {
    font-size: 55px;
    opacity: .9;
    padding-right: 15px;
}

/* Statistics */

.section-heading {
    margin-bottom: 17px;
}

.section-heading h2 {
    font-size: 18px;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 19px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 13px;
}

.stat-card strong {
    display: block;
    font-size: 27px;
    margin-bottom: 8px;
}

.stat-description {
    color: var(--muted);
    font-size: 11px;
}

/* Content panels */

.content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 17px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 21px;
}

.panel-heading {
    margin-bottom: 20px;
}

.panel-heading h3 {
    margin: 0;
    font-size: 15px;
}

.empty-state {
    min-height: 145px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-state > span {
    font-size: 27px;
    color: var(--blue);
    margin-bottom: 10px;
}

.empty-state strong {
    font-size: 13px;
}

.empty-state p {
    font-size: 11px;
    color: var(--muted);
}

.system-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.system-row:last-child {
    border-bottom: none;
}

.status-pill {
    color: #7EE0A0;
    background: rgba(126,224,160,.12);
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 10px;
}

.status-pill.neutral {
    color: var(--muted);
    background: var(--secondary);
}

footer {
    margin-top: 35px;
    color: var(--muted);
    font-size: 11px;
}

footer span {
    padding: 0 5px;
}

/* Responsive layout */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 750px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 15px;
    }

    .branding {
        padding-bottom: 15px;
    }

    nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .nav-item {
        white-space: nowrap;
        padding: 10px;
    }

    .nav-divider,
    .sidebar-footer {
        display: none;
    }

    .main {
        padding: 23px 16px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

@media (max-width: 450px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .welcome {
        padding: 22px;
    }

    .welcome-icon {
        font-size: 38px;
        padding: 0;
    }
}

/* Admin login */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.login-branding h1 {
    font-size: 22px;
    letter-spacing: 1px;
}

.login-branding span:not(.logo-red):not(.logo-blue) {
    color: var(--muted);
    font-size: 12px;
}

.login-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
}

.login-panel h2 {
    margin: 10px 0 6px;
    font-size: 24px;
}

.login-panel > p {
    margin: 0 0 25px;
    color: var(--muted);
    font-size: 13px;
}

.login-panel form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-panel label,
.product-editor label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.login-panel input,
.product-editor input,
.catalogue-toolbar input,
.catalogue-toolbar select,
.unresolved-row input,
.unresolved-row select {
    width: 100%;
    min-width: 0;
    background: var(--background);
    color: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.login-panel input:focus,
.product-editor input:focus,
.catalogue-toolbar input:focus,
.catalogue-toolbar select:focus,
.unresolved-row input:focus,
.unresolved-row select:focus {
    border-color: var(--blue);
}

.login-panel input {
    margin-bottom: 12px;
}

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

.login-container footer {
    text-align: center;
}

.login-error {
    padding: 11px 13px;
    margin-bottom: 18px;
    border: 1px solid rgba(226,29,56,.5);
    background: rgba(226,29,56,.12);
    color: #ff8797;
    border-radius: 6px;
    font-size: 13px;
}

/* Admin buttons */

.admin-button {
    border: 0;
    border-radius: 6px;
    padding: 11px 16px;
    background: var(--red);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, background .2s;
}

.admin-button:hover {
    opacity: .85;
}

.admin-button:disabled {
    opacity: .5;
    cursor: wait;
}

.secondary-button {
    background: var(--secondary);
    border: 1px solid var(--border);
}

.save-button {
    min-width: 125px;
}

.small-button {
    padding: 9px 13px;
    white-space: nowrap;
}

.text-button {
    background: transparent;
    color: #70c7f0;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 13px;
    cursor: pointer;
    font-size: 12px;
}

.text-button:hover {
    background: var(--secondary);
}

/* Product catalogue */

.catalogue-stats {
    margin-bottom: 22px;
}

.catalogue-panel {
    padding: 23px;
}

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

.catalogue-heading h2 {
    font-size: 18px;
    margin: 0;
}

.catalogue-heading p,
.sku-heading p {
    color: var(--muted);
    font-size: 12px;
    margin: 6px 0 0;
}

.catalogue-total {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.catalogue-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 12px;
    margin-bottom: 18px;
}

.catalogue-message {
    padding: 12px 14px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 13px;
}

.catalogue-message.success {
    background: rgba(126,224,160,.12);
    border: 1px solid rgba(126,224,160,.3);
    color: #7EE0A0;
}

.catalogue-message.error {
    background: rgba(226,29,56,.12);
    border: 1px solid rgba(226,29,56,.4);
    color: #ff8797;
}

.products-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.product-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.product-card.ignored-product {
    border-left: 3px solid var(--red);
}

.product-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 16px;
}

.product-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.product-identity > div {
    min-width: 0;
}

.product-identity strong {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.product-meta {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.product-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--secondary);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.product-editor {
    padding: 19px;
    border-top: 1px solid var(--border);
    background: var(--card);
}

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

.editor-grid label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ignored-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 18px;
    cursor: pointer;
}

.ignored-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 17px;
}

.sku-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sku-heading {
    margin-bottom: 14px;
}

.sku-heading h3 {
    font-size: 14px;
    margin: 0;
}

.sku-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.sku-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sku-code {
    align-self: center;
    font-family: monospace;
    font-size: 13px;
    color: #70c7f0;
}

.unresolved-section {
    margin-top: 25px;
    padding: 20px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.unresolved-section > .sku-heading h3 {
    color: #ffb86b;
}

.unresolved-row {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1.2fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.unresolved-row:last-child {
    border-bottom: 0;
}

.unresolved-row > strong {
    color: #ffb86b;
    font-family: monospace;
    font-size: 13px;
}

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

@media (max-width: 750px) {
    .catalogue-panel {
        padding: 16px;
    }

    .catalogue-toolbar {
        grid-template-columns: 1fr;
    }

    .catalogue-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .catalogue-total {
        text-align: left;
    }

    .unresolved-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .unresolved-row > strong {
        margin-bottom: 2px;
    }

    .sku-row {
        grid-template-columns: 65px minmax(0, 1fr);
    }

    .sku-row button {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 450px) {
    .login-panel {
        padding: 23px;
    }

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

    .product-editor {
        padding: 14px;
    }

    .product-main {
        padding: 12px;
    }
}
