:root {
  --sac-red: #e30613;
  --sac-red-dark: #b9000b;
  --sac-navy: #213857;
  --ink: #262626;
  --muted: #706f6f;
  --line: #dedede;
  --surface: #f5f5f3;
  --white: #fff;
  --success: #227044;
  --warning: #a36200;
  --radius: 3px;
  --shadow: 0 12px 35px rgb(33 56 87 / 10%);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--white); font-family: "Hind", "Segoe UI", Arial, sans-serif; font-size: 17px; line-height: 1.55; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 1.25rem; color: var(--sac-navy); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.06; font-weight: 600; }
h2 { color: var(--sac-navy); line-height: 1.2; font-size: 1.3rem; }

.wide, .narrow, .header-inner, .footer-inner { width: min(100% - 2rem, 1220px); margin-inline: auto; }
.narrow { max-width: 780px; }
.page-space { padding-block: clamp(2.5rem, 6vw, 5rem); min-height: 65vh; }
.eyebrow { margin-bottom: .5rem; color: var(--sac-red); text-transform: uppercase; letter-spacing: .11em; font-weight: 700; font-size: .78rem; }
.lead { color: var(--sac-navy); font-size: 1.2rem; }
.fine-print { color: var(--muted); font-size: .88rem; }

.site-header { position: relative; z-index: 2; color: var(--white); background: var(--sac-red); border-bottom: 5px solid var(--sac-navy); }
.header-inner { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: flex; align-items: center; gap: 1.15rem; text-decoration: none; font-weight: 600; }
.brand img { width: 155px; max-height: 58px; }
.brand span { padding-left: 1rem; border-left: 1px solid rgb(255 255 255 / 50%); }
.site-header nav { display: flex; align-items: center; gap: 1.4rem; }
.site-header nav a { text-decoration: none; font-weight: 600; }
.site-header nav a:hover { text-decoration: underline; }
.site-header form { margin: 0; }
.cart-link span { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; margin-left: .25rem; padding: 0 .35rem; color: var(--sac-red); background: var(--white); border-radius: 99px; font-size: .8rem; }
.supplier-progress-strip { color: var(--white); background: var(--sac-navy); }
.supplier-progress-inner { width: min(100% - 2rem, 1220px); margin-inline: auto; display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .55rem 0; font-size: .86rem; }
.supplier-progress-item { display: flex; flex-wrap: wrap; gap: .45rem; }
.supplier-progress-item strong { color: #fff; }
.supplier-progress-item span { color: #dfe7f0; }

.site-footer { color: var(--white); background: var(--sac-navy); }
.footer-inner { min-height: 170px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.footer-inner img { width: 180px; }
.footer-inner p { margin: 0; }
.catalog-data-status { color: #dfe7f0; font-size: .88rem; text-align: right; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .68rem 1.2rem; border: 2px solid transparent; border-radius: var(--radius); text-decoration: none; cursor: pointer; font-weight: 700; }
.button.primary { color: var(--white); background: var(--sac-red); }
.button.primary:hover { background: var(--sac-red-dark); }
.button.secondary { color: var(--sac-navy); background: var(--white); border-color: var(--sac-navy); }
.button.danger { color: var(--sac-red); background: var(--white); border-color: var(--sac-red); }
.button.danger:hover { color: var(--white); background: var(--sac-red); }
.button.small { min-height: 38px; padding: .35rem .75rem; font-size: .85rem; }
.button.full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.link-button { padding: 0; color: inherit; background: none; border: 0; cursor: pointer; text-decoration: underline; }
.link-button.danger { color: var(--sac-red); font-size: .9rem; }
.text-action, .subtle-link, .back-link { color: var(--sac-red); font-weight: 700; text-underline-offset: .18em; }
.back-link { display: inline-block; margin-bottom: 2rem; }

input, select, textarea { width: 100%; min-height: 46px; padding: .58rem .7rem; color: var(--ink); background: var(--white); border: 1px solid #aaa; border-radius: var(--radius); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgb(227 6 19 / 20%); border-color: var(--sac-red); }
label { color: var(--sac-navy); font-weight: 600; }
.stack-form { display: grid; gap: .8rem; }
.checkbox-label { display: flex; align-items: center; gap: .65rem; }
.checkbox-label input { width: 1.2rem; min-height: 1.2rem; flex: 0 0 auto; }

.auth-page { color: var(--white); background: linear-gradient(125deg, var(--sac-navy) 0 44%, #17283e 44% 100%); }
.auth-shell { width: min(100% - 2rem, 1060px); min-height: 100vh; margin: auto; display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: clamp(3rem, 8vw, 8rem); }
.auth-brand img { width: 280px; }
.auth-brand p { margin-top: 1rem; font-size: 1.35rem; }
.auth-card { color: var(--ink); background: var(--white); padding: clamp(2rem, 6vw, 4.5rem); box-shadow: var(--shadow); }
.auth-card h1 { font-size: clamp(2rem, 4vw, 3rem); }
.auth-card .subtle-link { display: inline-block; margin-top: 1rem; }
.dev-link { margin-block: 1rem; padding: 1rem; background: #fff4cc; border-left: 4px solid var(--warning); }
.dev-link a { color: var(--sac-navy); }

.alert { margin: 1rem 0; padding: .9rem 1rem; border-left: 4px solid; }
.alert.error { color: #7a0910; background: #fdecee; border-color: var(--sac-red); }
.alert.success { color: #164c30; background: #eaf6ef; border-color: var(--success); }

.terms-form { margin-top: 2rem; }
.terms-list { margin: 0 0 2rem; padding: 0; list-style: none; counter-reset: terms; }
.terms-list li { position: relative; margin-bottom: 1px; padding: 1.4rem 1.4rem 1.4rem 4.3rem; background: var(--surface); counter-increment: terms; }
.terms-list li::before { content: counter(terms); position: absolute; left: 1.2rem; top: 1.15rem; width: 2rem; height: 2rem; display: grid; place-items: center; color: var(--white); background: var(--sac-red); border-radius: 99px; font-weight: 700; }
.terms-list p { margin: .3rem 0 0; color: var(--muted); }
.check-row { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: 1.2rem; }
.check-row input { width: 1.2rem; min-height: 1.2rem; margin-top: .25rem; }

.page-heading, .order-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.catalog-filter { display: grid; gap: 1.2rem; margin-bottom: 2.5rem; padding: 1.3rem; background: var(--surface); border-top: 4px solid var(--sac-red); }
.catalog-filter-form { grid-template-columns: minmax(170px, .7fr) minmax(220px, 1fr) minmax(260px, 1.4fr) auto; align-items: end; }
.catalog-filter-form label { display: grid; gap: .25rem; font-size: .9rem; }
.filter-group { display: grid; grid-template-columns: 120px 1fr; align-items: start; gap: 1rem; }
.filter-group > strong { color: var(--sac-navy); }
.filter-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.filter-options a { padding: .38rem .7rem; color: var(--sac-navy); background: var(--white); border: 1px solid var(--line); text-decoration: none; }
.filter-options a:hover { border-color: var(--sac-red); }
.filter-options a.active { color: var(--white); background: var(--sac-navy); border-color: var(--sac-navy); font-weight: 700; }
.catalog-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.catalog-search label { display: grid; gap: .25rem; font-size: .9rem; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; }
.product-card { display: flex; min-width: 0; flex-direction: column; background: var(--white); border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-image { min-height: 260px; display: grid; place-items: center; padding: 1.2rem; overflow: hidden; background: var(--surface); color: var(--muted); text-decoration: none; }
.product-image img { width: 100%; height: 245px; object-fit: contain; }
.product-copy { flex: 1; display: flex; flex-direction: column; padding: 1.3rem; }
.product-copy h2 a { text-decoration: none; }
.product-copy p { color: var(--muted); }
.product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.price-pair { display: grid; justify-items: start; }
.price-pair strong { color: var(--sac-navy); font-size: 1.15rem; }
.list-price { color: var(--muted); text-decoration: line-through; font-size: .86rem; }
.discount-label { color: var(--sac-red); font-size: .78rem; font-weight: 700; }
.card-badges { min-height: 1.6rem; display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin-bottom: .6rem; }
.badge { align-self: flex-start; padding: .15rem .5rem; color: var(--white); background: var(--sac-red); text-transform: uppercase; font-size: .72rem; font-weight: 700; }
.availability-state { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.availability-state::before { width: .72rem; height: .72rem; flex: 0 0 auto; content: ""; background: #8b8b8b; border-radius: 50%; box-shadow: 0 0 0 2px rgb(0 0 0 / 8%); }
.availability-AVAILABLE::before { background: var(--success); }
.availability-INBOUND::before { background: #e59a00; }
.availability-UNAVAILABLE::before { background: var(--sac-red); }
.empty-state { padding: 4rem 2rem; text-align: center; background: var(--surface); }
.result-count { margin: -1.25rem 0 1.25rem; color: var(--muted); font-size: .9rem; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 2.5rem; }
.pagination a, .pagination span { min-width: 2.5rem; padding: .45rem .7rem; text-align: center; border: 1px solid var(--line); text-decoration: none; }
.pagination a:hover { border-color: var(--sac-red); }
.pagination a.active { color: var(--white); background: var(--sac-navy); border-color: var(--sac-navy); font-weight: 700; }
.pagination .disabled { color: var(--muted); background: var(--surface); }

.product-detail { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(400px, 1.1fr); gap: clamp(2rem, 6vw, 5rem); }
.detail-image { min-height: 450px; display: grid; place-items: center; padding: 2rem; background: var(--surface); color: var(--muted); }
.detail-image img { width: 100%; height: 520px; object-fit: contain; }
.manufacturer-link { display: inline-block; margin: -.4rem 0 1.25rem; color: var(--sac-red); font-weight: 700; text-underline-offset: .18em; }
.description { white-space: pre-line; }
.variant-list { margin-top: 2rem; border-top: 4px solid var(--sac-navy); }
.variant { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.variant h2 { margin-bottom: .5rem; font-size: 1rem; }
.option-list { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 0; }
.option-list div { display: flex; gap: .3rem; }
.option-list dt { color: var(--muted); }
.option-list dd { margin: 0; }
.stock-import-time { margin: 1rem 0; color: var(--muted); font-size: .86rem; }
.availability-panel { margin-top: .8rem; padding: .7rem .8rem; background: var(--surface); border-left: 3px solid var(--line); font-size: .9rem; }
.availability-panel:has(.availability-AVAILABLE) { border-color: var(--success); }
.availability-panel:has(.availability-INBOUND) { border-color: #e59a00; }
.availability-panel:has(.availability-UNAVAILABLE) { border-color: var(--sac-red); }
.availability-panel p { margin: .35rem 0 0; color: var(--muted); }
.buy-box { min-width: 185px; display: grid; gap: .55rem; }
.buy-box .price-pair { justify-items: end; }
.buy-box label { display: grid; grid-template-columns: auto 70px; align-items: center; gap: .5rem; font-size: .85rem; }

.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1fr 340px; align-items: start; gap: 2rem; }
.cart-items { border-top: 4px solid var(--sac-navy); }
.cart-item { display: grid; grid-template-columns: 110px minmax(180px, 1fr) 140px 125px; align-items: center; gap: 1.2rem; padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.cart-thumb { width: 110px; height: 100px; display: grid; place-items: center; background: var(--surface); }
.cart-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-description h2 { margin: 0; font-size: 1.1rem; }
.cart-description h2 a { text-decoration: none; }
.cart-description p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.quantity-form { display: grid; gap: .35rem; }
.quantity-form label { font-size: .82rem; }
.line-price { text-align: right; }
.line-price form { margin-top: .5rem; }
.summary-card, .panel { padding: 1.5rem; background: var(--surface); border-top: 4px solid var(--sac-red); }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.summary-row.total { margin-bottom: 1rem; color: var(--sac-navy); font-size: 1.15rem; border-bottom: 2px solid var(--sac-navy); }
.review-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.review-item p { margin: .2rem 0 0; color: var(--muted); }
.terms-reminder { margin-top: 2.5rem; padding: 1.5rem; background: var(--surface); }
.terms-reminder li + li { margin-top: .5rem; }

.status { display: inline-flex; align-items: center; padding: .25rem .65rem; white-space: nowrap; border-radius: 99px; background: #eee; font-weight: 700; font-size: .82rem; }
.status-AWAITING_PAYMENT { color: #7a4500; background: #fff0ce; }
.status-PAID { color: #17472e; background: #dff2e7; }
.status-ORDERED_WITH_SUPPLIER { color: #493476; background: #ece5fa; }
.status-READY_FOR_PICKUP { color: #163d73; background: #e0ecfb; }
.status-COMPLETED { color: #444; background: #e7e7e7; }
.status-CANCELLED { color: #770812; background: #f9dfe2; }
.order-heading { margin-bottom: 2rem; }
.payment-panel { display: grid; grid-template-columns: 1fr 260px; gap: 3rem; margin-bottom: 3rem; padding: clamp(1.5rem, 4vw, 3rem); color: var(--white); background: var(--sac-navy); border-left: 7px solid var(--sac-red); }
.payment-panel h2, .payment-panel .eyebrow { color: var(--white); }
.payment-data { margin: 1.5rem 0; }
.payment-data div { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; padding: .35rem 0; }
.payment-data dt { color: #b9c6d7; }
.payment-data dd { margin: 0; font-weight: 600; }
.iban { letter-spacing: .08em; }
.qr-box { display: grid; place-items: center; align-self: start; gap: .2rem; padding: 1rem; color: var(--ink); background: var(--white); font-size: .82rem; text-align: center; }
.qr-box strong { margin-top: .4rem; color: var(--sac-navy); font-size: 1rem; }
.qr-box img { width: 220px; }
.order-items { margin-top: 2rem; }
.grand-total { display: flex; justify-content: flex-end; gap: 3rem; padding: 1rem 0; color: var(--sac-navy); font-size: 1.25rem; border-top: 3px solid var(--sac-navy); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--white); background: var(--sac-navy); text-align: left; }
th, td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: var(--surface); }
.status-filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.status-filter a { padding: .45rem .8rem; color: var(--sac-navy); background: var(--surface); text-decoration: none; border-bottom: 3px solid transparent; }
.status-filter a.active { border-color: var(--sac-red); font-weight: 700; }
.admin-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.order-status-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.order-status-actions form { margin: 0; }
.panel { background: var(--surface); }
.intro-panel { max-width: 900px; padding: clamp(1.5rem, 4vw, 3rem); background: var(--surface); border-left: 6px solid var(--sac-red); }
.terms-intro { margin-top: 2rem; }
.category-section { margin-top: 2.5rem; }
.category-section + .category-section { padding-top: 2.5rem; border-top: 1px solid var(--line); }
.category-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.2rem; }
.category-section-heading h2 { margin-bottom: 0; font-size: 1.75rem; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.category-card { min-height: 210px; display: flex; flex-direction: column; padding: 1.4rem; border: 1px solid var(--line); border-top: 4px solid var(--sac-navy); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.category-card:hover { transform: translateY(-3px); border-top-color: var(--sac-red); box-shadow: var(--shadow); }
.category-card h3 { margin: 0 0 .7rem; color: var(--sac-navy); font-size: 1.25rem; line-height: 1.2; }
.category-card p { color: var(--muted); }
.category-action { margin-top: auto; color: var(--sac-red); font-weight: 700; text-decoration: underline; text-underline-offset: .18em; }
.supplier-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.supplier-admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.supplier-order-action { margin-top: 1rem; }
.order-template { min-height: 260px; margin-bottom: 1rem; resize: vertical; white-space: pre; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.terms-admin-form { display: grid; gap: 1.5rem; }
.terms-admin-list { display: grid; gap: 1rem; }
.terms-admin-clause { display: grid; grid-template-columns: 140px minmax(220px, .8fr) minmax(320px, 1.5fr); align-items: start; gap: 1rem; }
.terms-admin-clause label { display: grid; gap: .3rem; }
.terms-admin-clause textarea { resize: vertical; }
.terms-admin-clause .remove-clause { grid-column: 2 / -1; display: flex; }
.terms-admin-clause .remove-clause input { width: 1.2rem; }
.terms-admin-clause h2 { grid-column: 1 / -1; margin-bottom: 0; }
.new-clause { border-top-color: var(--sac-navy); }

@media (max-width: 900px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding-block: 1rem; }
  .site-header nav { width: 100%; flex-wrap: wrap; gap: .8rem 1.2rem; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-detail, .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 90px 1fr 120px; }
  .cart-thumb { width: 90px; height: 85px; }
  .line-price { grid-column: 2 / -1; display: flex; justify-content: space-between; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .wide, .narrow, .header-inner, .footer-inner { width: min(100% - 1.2rem, 1220px); }
  .auth-shell { width: min(100% - 1.2rem, 1060px); grid-template-columns: 1fr; align-content: center; gap: 2rem; padding-block: 2rem; }
  .auth-brand img { width: 200px; }
  .auth-brand p { display: none; }
  .auth-card { padding: 1.5rem; }
  .brand img { width: 130px; }
  .brand span { font-size: .9rem; }
  .site-header nav { font-size: .9rem; }
  .footer-inner, .page-heading, .order-heading { align-items: flex-start; flex-direction: column; padding-block: 2rem; }
  .product-grid, .category-grid, .admin-detail-grid, .supplier-admin-grid, .terms-admin-clause { grid-template-columns: 1fr; }
  .terms-admin-clause .remove-clause, .terms-admin-clause h2 { grid-column: auto; }
  .category-section-heading { align-items: flex-start; flex-direction: column; gap: .5rem; }
  .filter-group { grid-template-columns: 1fr; gap: .5rem; }
  .catalog-search { grid-template-columns: 1fr; }
  .catalog-filter-form { grid-template-columns: 1fr; }
  .product-image { min-height: 220px; }
  .product-detail { display: block; }
  .detail-image { min-height: 300px; margin-bottom: 2rem; }
  .detail-image img { height: 340px; }
  .variant { grid-template-columns: 1fr; }
  .buy-box .price-pair { justify-items: start; }
  .cart-item { grid-template-columns: 75px 1fr; align-items: start; }
  .cart-thumb { width: 75px; height: 75px; }
  .quantity-form, .line-price { grid-column: 2; }
  .payment-panel { grid-template-columns: 1fr; gap: 1.5rem; }
  .qr-box { justify-self: center; }
  .payment-data div { grid-template-columns: 1fr; gap: 0; }
}
