:root {
    --app-primary: #6b6ee8;
    --app-primary-hover: #5a5dd6;
    --app-heading: #2b2d5e;
    --app-muted: #8b8ca3;
    --app-border: #d9d9e6;
    --app-bg: #f4f4fb;

    --bs-primary: #6b6ee8;
    --bs-primary-rgb: 107, 110, 232;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: #3b3d5c;
    --bs-link-color-rgb: 107, 110, 232;
    --bs-link-hover-color-rgb: 90, 93, 214;
}

body {
    background-color: var(--app-bg);
}

/* Keskitetty kortti; mobiilissa koko näytön levyinen ilman reunoja */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    padding: 3rem 2rem;
}

@media (min-width: 576px) {
    .auth-card {
        border-radius: 2rem;
        box-shadow: 0 1rem 3rem rgba(43, 45, 94, .08);
        padding: 3.5rem 2.75rem;
    }
}

@media (max-width: 575.98px) {
    body { background: #fff; }
    .auth-wrapper { align-items: flex-start; }
}

.auth-title {
    color: var(--app-heading);
    font-weight: 700;
    font-size: 2.4rem;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.auth-subtitle {
    color: var(--app-muted);
}

/* Syöttökenttä, jonka nimi on reunaviivan päällä */
.field {
    position: relative;
}

.field label {
    position: absolute;
    top: -.65rem;
    left: .85rem;
    padding: 0 .35rem;
    background: #fff;
    font-size: .875rem;
    line-height: 1.2;
    color: var(--app-muted);
    transition: color .15s;
}

.field .form-control {
    height: 3.5rem;
    padding: .75rem 1.1rem;
    border-color: var(--app-border);
    border-radius: .5rem;
}

.field .form-control::placeholder {
    color: #a9aabd;
}

.field .form-control:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem rgba(107, 110, 232, .15);
}

.field:focus-within label {
    color: var(--app-primary);
}

.form-check-input:checked {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.form-check-input:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem rgba(107, 110, 232, .15);
}

.auth-card .form-check-label {
    color: var(--app-muted);
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-hover);
    --bs-btn-hover-border-color: var(--app-primary-hover);
    --bs-btn-active-bg: var(--app-primary-hover);
    --bs-btn-active-border-color: var(--app-primary-hover);
    --bs-btn-focus-shadow-rgb: 107, 110, 232;
    --bs-btn-border-radius: .5rem;
}

/* Isot painikkeet kuten kirjautumissivulla; .btn-sm pysyy pienenä. */
.btn:not(.btn-sm) {
    --bs-btn-padding-y: .95rem;
}

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: var(--app-border);
    --bs-btn-hover-bg: var(--app-primary);
    --bs-btn-hover-border-color: var(--app-primary);
    --bs-btn-border-radius: .5rem;
}

/* Tervetulosivu */
.avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b6ee8, #b06ee8);
    color: #fff;
    font-weight: 600;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Sovelluksen yläpalkki */
.app-brand {
    color: var(--app-heading);
    font-weight: 700;
    font-size: 1.15rem;
}

.app-nav-link {
    color: var(--bs-body-color);
    text-decoration: none;
}

.app-nav-link:hover {
    color: var(--app-primary);
}

.app-org {
    background: rgba(107, 110, 232, .1);
    color: var(--app-primary);
    font-weight: 600;
    font-size: .875rem;
    padding: .3rem .75rem;
    border-radius: 999px;
}

.org-choice {
    font-weight: 600;
}

/* Sisältökortti sovelluksen sivuilla */
.content-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 .5rem 2rem rgba(43, 45, 94, .06);
    padding: 1.5rem;
}

@media (min-width: 576px) {
    .content-card { padding: 2rem; }
}

.page-title {
    color: var(--app-heading);
    font-weight: 700;
}

.app-nav-link.active {
    color: var(--app-primary);
    font-weight: 600;
}

.welcome-email {
    font-size: 1.75rem;
    overflow-wrap: break-word;
}

@media (max-width: 575.98px) {
    .welcome-email { font-size: 1.5rem; }
}

.auth-card.welcome-card {
    max-width: 560px;
}

.app-user {
    font-weight: 600;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hallinta */
.admin-tabs {
    --bs-nav-pills-link-active-bg: var(--app-primary);
    --bs-nav-link-color: var(--app-primary);
    --bs-nav-link-hover-color: var(--app-primary-hover);
}

.org-badge {
    background: rgba(107, 110, 232, .1);
    color: var(--app-primary);
    font-weight: 600;
    margin: 0 .25rem .25rem 0;
}

.min-w-0 {
    min-width: 0;
}

.admin-user-row.is-inactive .fw-semibold {
    color: var(--app-muted);
}

/* Lapputulostin */
.carrier-status li {
    color: var(--app-muted);
    margin-bottom: .2rem;
}

.status-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
}

.status-dot.is-ok { background: #2fb36d; }
.status-dot.is-off { background: #c7c8d6; }

select.form-select optgroup {
    color: var(--app-heading);
}

/* Shopify-haku lapputulostimessa */
.shopify-lookup {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--app-border);
}

.shopify-status.is-ok { color: #1e8a52; }
.shopify-status.is-error { color: #b42318; }

/* Tuotelista: koko rivi on linkki tuotteen sivulle (Bootstrapin stretched-link). */
.product-table tbody tr { position: relative; cursor: pointer; }
.product-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--app-muted); font-weight: 600; }
.product-table td:first-child, .product-table th:first-child { padding-left: 1.25rem; }
.product-table td:last-child, .product-table th:last-child { padding-right: 1.25rem; }
.product-table th .sort-link { color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor; }
.product-table th .sort-link:hover, .product-table th .sort-link.active { color: var(--app-primary); border-bottom-style: solid; }
.product-search { min-width: min(100%, 22rem); }


/* Myyntikanavien tila tuotelistassa ja tuotesivulla. */
.channel-badge { display: inline-block; padding: .1rem .45rem; border-radius: .35rem; font-size: .75rem; font-weight: 600; line-height: 1.4; }
.channel-badge.is-on-sale { background: #dcf5e7; color: #1d7a48; }
.channel-badge.is-created { background: #fdf0d5; color: #8a5a00; }
.channel-badge.is-missing { background: #f1f1f6; color: #9a9bb0; }
.channel-markets { display: inline-flex; gap: .2rem; }
/* Rivin linkki (stretched-link) peittää solut; merkin selite näkyy silti hiiren alla. */
.product-table .channel-badge { position: relative; z-index: 2; cursor: help; }

/* Ostotilaukset */
.po-status { display: inline-block; padding: .1rem .5rem; border-radius: .35rem; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.po-status.is-open { background: #e6e7fb; color: #4b4ec9; }
.po-status.is-delivered { background: #dcf5e7; color: #1d7a48; }
.po-status.is-archived { background: #f1f1f6; color: #7d7e94; }
.po-filter .form-select { min-width: 11rem; width: auto; }
.po-lines .po-num { width: 6.5rem; }
.po-lines .po-money { width: 9.5rem; }
.po-lines .form-control { min-width: 5rem; }

/* Tuotelistan myyntikanavien tilojen selite: tiivis, ei korttien isoa sisämarginaalia. */
.content-card.channel-legend { padding: .9rem 1.25rem; }
.channel-legend > ul > li { margin-bottom: .35rem; }
.channel-legend > ul > li > ul { margin-top: .25rem; padding-left: 1.25rem; }

/* Kuluvyörytyksen kurssin hyväksyntä (ostotilaus) */
.po-allocation-dialog {
    width: min(34rem, calc(100vw - 2rem));
    border: 0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

.po-allocation-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}
