:root {
    --ink: #244a70;
    --green: #287246;
    --green-soft: #e9f6e9;
    --blue-soft: #eaf7fb;
    --cream: #fff7df;
    --line: #bdd6c4;
    --danger: #9c2f2f;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, #e5f9fb 0, transparent 34rem),
        linear-gradient(180deg, #fff 0, #f8fbf7 100%);
    font: 14px/1.5 Tahoma, Verdana, sans-serif;
}
a { color: #064fbd; }
h1, h2 { margin: 0 0 14px; color: #164c75; font-family: Georgia, serif; line-height: 1.15; }
h1 { font-size: clamp(25px, 4vw, 38px); }
h2 { font-size: 21px; }
.site-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px max(16px, calc((100vw - 1040px) / 2));
    background: #dff7fb;
    border-bottom: 1px solid #add9dd;
}
.logo { color: #135786; font: bold 26px Georgia, serif; text-decoration: none; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.page { width: min(1040px, calc(100% - 24px)); margin: 24px auto 50px; }
.hero, .panel {
    padding: clamp(18px, 4vw, 34px);
    border: 1px solid var(--line);
    background: rgba(255,255,255,.94);
    box-shadow: 0 12px 34px rgba(25,77,63,.08);
}
.hero { background: linear-gradient(135deg, var(--blue-soft), #fff 62%, var(--cream)); }
.hero.compact { padding: 22px 28px; }
.panel { margin-top: 18px; }
.panel.narrow { max-width: 680px; margin: 20px auto; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-weight: bold; letter-spacing: .08em; text-transform: uppercase; }
.stack { display: grid; gap: 13px; }
label { display: grid; gap: 5px; font-weight: bold; }
input, select, textarea, button {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #9dbab0;
    border-radius: 2px;
    background: #fff;
    color: #173b58;
    font: inherit;
}
button, .button {
    display: inline-block;
    width: fit-content;
    padding: 9px 16px;
    border: 1px solid #6f973d;
    background: #e4f2b3;
    color: #234919;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
button.secondary { background: #edf4f7; border-color: #9eb8c4; color: #284d62; }
button.danger { background: #f9dede; border-color: #c98989; color: var(--danger); }
.center { text-align: center; }
.alert { margin: 12px 0; padding: 11px 13px; border: 1px solid; }
.alert.error { color: #851e1e; background: #fff0f0; border-color: #e1aaaa; }
.alert.success { color: #17622d; background: #ebf9ec; border-color: #9dccaa; }
.catalog-filter, .settings-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin: 16px 0;
    padding: 14px;
    background: var(--green-soft);
    border: 1px solid var(--line);
}
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.product-card {
    display: grid;
    grid-template-columns: 145px 1fr;
    gap: 16px;
    padding: 14px;
    border: 1px solid #c6dbc9;
    background: #fff;
}
.product-photo { display: grid; place-items: center; min-height: 135px; background: #f8fbf7; }
.product-photo img { max-width: 145px; max-height: 145px; }
.product-card h2 { margin-bottom: 5px; font-size: 19px; }
.seller { color: #597283; }
.retail-price { margin: 8px 0; color: var(--green); font-size: 23px; font-weight: bold; }
.buy-form { display: flex; gap: 7px; align-items: center; }
.buy-form input { width: 95px; }
.empty { padding: 22px; text-align: center; background: #f4faf4; border: 1px dashed #a9c7ac; }
.table-scroll { width: 100%; overflow-x: auto; }
.orders { width: 100%; border-collapse: collapse; color: #213f55; }
.orders th, .orders td { padding: 9px; border: 1px solid #c9d9d2; text-align: left; vertical-align: top; }
.orders th { background: #e7f6f7; }
.orders input[type=number] { width: 100px; }
.retail-row { min-width: 290px; }
.retail-row label { display: inline; font-weight: normal; }
.total { color: var(--green); font-size: 20px; font-weight: bold; text-align: right; }
.inline-form { display: inline-block; margin: 10px 0; }
.checkout { margin-top: 18px; padding: 16px; background: var(--cream); border: 1px solid #dcca91; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pager { display: flex; justify-content: space-between; }
footer { padding: 25px; text-align: center; color: #657b7b; }
@media (max-width: 760px) {
    .site-head { align-items: flex-start; flex-direction: column; }
    .product-grid { grid-template-columns: 1fr; }
    .product-card { grid-template-columns: 105px 1fr; padding: 10px; gap: 10px; }
    .product-photo { min-height: 100px; }
    .product-photo img { max-width: 105px; max-height: 105px; }
    .buy-form { align-items: stretch; flex-direction: column; }
    .buy-form input, .buy-form button { width: 100%; }
}
@media (max-width: 430px) {
    .page { width: calc(100% - 12px); margin-top: 8px; }
    .hero, .panel { padding: 14px; }
    .product-card { grid-template-columns: 1fr; }
    .product-photo img { max-width: 180px; max-height: 180px; }
}

/* torgo-mobile-field-fix */
.stack input:not([type=checkbox]),
.stack select,
.stack textarea {
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}
.stack .check {
    align-items: flex-start;
    display: flex;
    font-weight: normal;
    gap: 8px;
}
.stack .check input {
    min-height: 0;
    padding: 0;
    width: auto;
}

/* torgo-warehouse-product-admin */
.portal-actions,
.product-admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.portal-actions .button,
.product-admin-actions .button,
.product-admin-actions .inline-form { margin: 0; }
.warehouse-product-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.warehouse-product-card {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 15px;
    padding: 14px;
    border: 1px solid #c6dbc9;
    background: #fff;
}
.warehouse-product-card.is-inactive { background: #f4f4f1; opacity: .78; }
.warehouse-product-photo {
    display: grid;
    place-items: center;
    min-height: 125px;
    color: #6c7d7d;
    background: #f4faf4;
    border: 1px solid #d8e5d8;
}
.warehouse-product-photo img {
    display: block;
    width: 100%;
    max-height: 150px;
    object-fit: contain;
}
.warehouse-product-copy { min-width: 0; }
.warehouse-product-copy h2 { overflow-wrap: anywhere; }
.product-state {
    margin: 0 0 5px;
    color: var(--green);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.visibility-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.visibility-badge {
    padding: 2px 7px;
    border: 1px solid #bacbc3;
    border-radius: 12px;
    font-size: 12px;
}
.visibility-badge.is-visible { color: #17622d; background: #ebf9ec; border-color: #9dccaa; }
.visibility-badge.is-hidden { color: #717979; background: #f2f3f3; }
.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}
.visibility-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 0;
    padding: 13px;
    border: 1px solid var(--line);
    background: var(--green-soft);
}
.visibility-options legend { padding: 0 6px; font-weight: bold; }
.visibility-options .check { min-width: 150px; }
.current-image {
    width: min(100%, 420px);
    margin: 10px 0 14px;
    padding: 8px;
    border: 1px solid #d6e4d8;
    background: #f8fbf7;
}
.current-image img { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.form-help { color: #587080; font-size: 13px; overflow-wrap: anywhere; }
.import-rules {
    margin: 14px 0 20px;
    padding: 15px 18px;
    background: var(--cream);
    border: 1px solid #dcca91;
}
.import-rules li { margin: 6px 0; }
.compact-empty { max-width: 420px; padding: 14px; }
@media (max-width: 760px) {
    .warehouse-product-list,
    .field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
    .warehouse-product-card { grid-template-columns: 90px minmax(0, 1fr); gap: 9px; padding: 9px; }
    .warehouse-product-photo { min-height: 90px; }
    .product-admin-actions { align-items: stretch; flex-direction: column; }
    .product-admin-actions .button,
    .product-admin-actions button,
    .product-admin-actions .inline-form { width: 100%; }
    .portal-actions { align-items: stretch; flex-direction: column; }
    .portal-actions .button { width: 100%; text-align: center; }
}
/* torgo-csp-logout */
.logout-form {
    margin: 0;
    padding: 0 12px 24px;
    text-align: center;
}
.logout-form input[type=submit] {
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid #9eb8c4;
    background: #edf4f7;
    color: #284d62;
    cursor: pointer;
}