:root {
  --bg: #f8f9fa;
  --panel: #fff;
  --ink: #1e2428;
  --muted: #65727a;
  --line: #e5e7eb;
  --brand: #bd1f2d;
  --brand-strong: #8f1722;
  --accent: #ffd43b;
  --accent-soft: #f3f4f6;
  --info: #2678b8;
  --mint: #3ea870;
  --danger: #b33636;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { border: 0; }
.site-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px clamp(16px, 4vw, 42px) 18px;
  background: #fff;
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.admin-header { flex-direction: row; align-items: center; justify-content: space-between; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.site-header h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.05; }
.brand-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo {
  display: grid;
  min-width: 108px;
  padding: 9px 11px 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-weight: 1000;
  line-height: .92;
  text-align: center;
  text-decoration: none;
}
.brand-logo span { font-size: 1.28rem; }
.brand-logo small { color: rgba(255, 255, 255, 0.8); font-size: .68rem; font-weight: 1000; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.shell { flex: 1 0 auto; width: min(1160px, 100%); margin: 0 auto; padding: 20px 16px 80px; }
.site-footer { flex-shrink: 0; width: 100%; padding: 18px 16px 28px; color: var(--muted); font-size: .9rem; font-weight: 900; text-align: center; }
.dev-credit { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); opacity: .7; transition: opacity .2s; }
.dev-credit:hover { opacity: 1; }
.dev-credit span { font-size: .8rem; font-weight: 700; letter-spacing: .03em; }
.dev-logo { height: 28px; width: auto; object-fit: contain; border-radius: 4px; }
.footer-knit { flex-shrink: 0; display: flex; justify-content: center; padding: 0 16px 2px; pointer-events: none; }
.footer-knit:empty { display: none; }
.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 36, 40, 0.34);
  backdrop-filter: blur(2px);
}
.screen-overlay-card {
  width: min(460px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 22px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  text-align: center;
}
.screen-overlay-card p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
}
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.step { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); background: #fff; font-size: .82rem; font-weight: 900; text-align: center; }
.step.current { color: #fff; background: var(--brand); border-color: var(--brand); }
.step.completed { color: #145c36; background: #edf9f1; border-color: #b7ddc7; }
.step.pending { color: var(--muted); background: #fff; }
.step-check, .step-number { display: inline-grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 999px; font-size: .76rem; font-weight: 1000; }
.step-check { color: #fff; background: var(--mint); }
.step-number { color: var(--muted); background: var(--accent-soft); }
.step.current .step-number { color: var(--brand); background: rgba(255, 255, 255, 0.9); }
.panel, .card, .school-card, .product-card, .summary-box, .order-row, .detail-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 18px; margin-bottom: 16px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-title h2, .section-title h3 { margin: 0; font-size: 1.25rem; }
.section-title p, .muted { color: var(--muted); }
.catalog-title-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.payment-disclaimer { margin-top: 10px; }
.card-payment-options { display: grid; gap: 10px; margin-top: 10px; }
.radio-group.nested { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf8; }
.knit-animation {
  position: relative;
  width: min(440px, 92vw);
  height: 180px;
  overflow: hidden;
}
.knit-animation svg { display: block; width: 100%; height: 100%; }
.knit-yarn-soft,
.knit-thread,
.knit-thread-live,
.knit-stitches path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.knit-yarn-soft { stroke: rgba(189, 31, 45, .12); stroke-width: 18; }
.knit-thread { stroke: var(--brand); stroke-width: 4.5; stroke-dasharray: 10 10; animation: yarnFlow 2.8s linear infinite; }
.knit-thread-live { stroke: var(--accent); stroke-width: 5; stroke-dasharray: 62 160; stroke-dashoffset: 160; animation: stitchDraw 2.6s ease-in-out infinite; }
.knit-stitches path { stroke: #2678b8; stroke-width: 3; opacity: .7; stroke-dasharray: 76; animation: stitchPulse 3.2s ease-in-out infinite; }
.knit-stitches path:nth-child(2) { animation-delay: .25s; }
.knit-stitches path:nth-child(3) { animation-delay: .5s; }
.knit-stitches path:nth-child(4) { animation-delay: .75s; }
.knit-needle { transform-origin: 165px 70px; animation: needleWork 1.8s ease-in-out infinite; }
.knit-needle-back { opacity: .72; animation-delay: .35s; }
.knit-needle line { stroke: #8f1722; stroke-width: 6; stroke-linecap: round; }
.knit-needle path { fill: #8f1722; }
.knit-needle circle { fill: var(--accent); stroke: #8f1722; stroke-width: 2; }
@keyframes needleWork {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  45% { transform: translate(8px, -5px) rotate(3deg); }
  70% { transform: translate(-4px, 4px) rotate(-2deg); }
}
@keyframes yarnFlow {
  to { stroke-dashoffset: -40; }
}
@keyframes stitchDraw {
  0% { stroke-dashoffset: 160; opacity: .25; }
  45%, 70% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -110; opacity: .25; }
}
@keyframes stitchPulse {
  0%, 100% { opacity: .35; transform: translateY(0); }
  50% { opacity: .88; transform: translateY(-2px); }
}
.grid { display: grid; gap: 12px; }
.school-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.school-card, .order-row { display: grid; gap: 8px; padding: 12px; text-align: left; cursor: pointer; }
.school-card { min-height: 116px; align-content: space-between; }
.school-card h3 { margin: 0; font-size: 1rem; line-height: 1.2; }
.school-card strong { color: var(--muted); font-size: .86rem; }
.school-logo { display: grid; place-items: center; width: 64px; height: 44px; overflow: hidden; border-radius: var(--radius); color: #fff; background: var(--brand); font-weight: 1000; }
.school-logo img { width: 100%; height: 100%; object-fit: contain; }
.product-card { position: relative; display: grid; min-height: 0; height: 100%; gap: 8px; grid-template-rows: auto auto auto; padding: 12px; overflow: visible; text-align: left; cursor: default; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }
.school-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
.product-card:hover, .order-row:hover { border-color: var(--brand); }
.badge { display: inline-flex; width: max-content; min-height: 26px; align-items: center; padding: 3px 8px; border-radius: 999px; color: #145c36; background: #dcfce7; font-size: .78rem; font-weight: 900; }
.badge.mini { min-height: 22px; padding: 2px 7px; font-size: .72rem; }
.badge.closed { color: var(--danger); background: #fff0f0; }
.status-badge { border: 1px solid transparent; }
.status-pending { color: #8a4300; background: #fff1d6; border-color: #f3c782; }
.status-confirmed { color: #15558a; background: #e7f2ff; border-color: #aacfee; }
.status-paid { color: #145c36; background: #e2f7e9; border-color: #a9d9ba; }
.status-pending-shipping { color: #5c3b8f; background: #f0e9ff; border-color: #cdbcf2; }
.status-shipped { color: #0e6848; background: #d9f4ed; border-color: #8fd1bc; }
.status-pending-payment { color: #8a5a00; background: #fff3da; border-color: #f0cf8f; }
.status-collected { color: #0b5d63; background: #d7f3f5; border-color: #8fcdd2; }
.status-paid-pre { color: #145c36; background: #e2f7e9; border-color: #a9d9ba; }
.status-shipped-post { color: #0e6848; background: #d9f4ed; border-color: #8fd1bc; }
.status-finalized { color: #2b3a8f; background: #e6e9ff; border-color: #b3bcf0; }
.status-invoiced { color: #1f5f43; background: #dff6ec; border-color: #9fd9be; }
.status-flow-help { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf8; font-size: .88rem; }
.status-flow-help p { margin: 0; }
.status-cancelled { color: #9d1f1f; background: #ffe3e3; border-color: #efa5a5; }
.state-graph-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.state-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.state-targets { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.state-arrow { color: #65727a; font-weight: 800; }
.catalog-layout, .admin-layout { display: grid; gap: 16px; }
.admin-tabs, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tab { min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--panel); font-weight: 800; cursor: pointer; }
.tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.catalog-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin: 14px 0; }
.catalog-search { color: var(--muted); font-size: .82rem; text-transform: uppercase; }
.catalog-search input { margin-top: 2px; font-size: 1rem; text-transform: none; }
.product-grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 10px; align-items: stretch; justify-content: stretch; }
.product-card { align-content: stretch; }
.product-main { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: start; }
.product-thumb { display: grid; place-items: center; width: 72px; height: 72px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); color: var(--brand); font-size: .72rem; font-weight: 900; overflow: hidden; cursor: zoom-in; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-thumb:disabled { cursor: default; opacity: 1; }
.product-copy { min-width: 0; }
.product-copy h3 { min-width: 0; margin: 0 0 5px; overflow: visible; font-size: .94rem; line-height: 1.18; white-space: normal; overflow-wrap: anywhere; }
.price { color: var(--brand); font-size: .95rem; font-weight: 1000; line-height: 1.1; white-space: nowrap; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.product-editor-grid { grid-template-columns: minmax(150px, 180px) minmax(240px, 420px); align-items: end; }
.product-editor-grid .product-base-price input { max-width: 180px; }
.product-editor-grid .product-name-field input { max-width: 420px; }
.form-actions { grid-column: 1 / -1; margin-top: 12px; }
.radio-group {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.radio-group legend { padding: 0 6px; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-weight: 700;
  font-size: .9rem;
}
.radio-group label:has(input:checked) {
  border-color: var(--brand);
  background: #fef2f2;
  color: var(--brand-strong);
}
.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: auto;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.radio-group input[type="radio"]:checked {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3px #fff;
}
.inline-notice { flex: 1 0 100%; margin: 2px 0 0; font-size: .86rem; }
.surcharge-line { color: var(--brand-strong); font-weight: 800; }
.submit-area { display: grid; justify-items: center; gap: 12px; }
.submit-hint { width: 100%; margin: 0; }
.submit-area .primary { min-width: 220px; }
.done-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.done-actions .primary, .done-actions .secondary { min-width: 220px; }
.product-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.product-picker .product-notes { grid-column: auto; }
label { display: grid; gap: 6px; font-size: .9rem; font-weight: 800; }
.product-card label { gap: 4px; font-size: .74rem; color: var(--muted); text-transform: uppercase; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; color: var(--ink); background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(189, 31, 45, 0.12); }
.product-card input, .product-card select { min-height: 34px; padding: 6px 8px; font-size: .88rem; }
.product-card select:disabled { color: var(--muted); background: var(--accent-soft); opacity: 1; }
textarea { min-height: 86px; resize: vertical; }
.hidden { display: none !important; }
.hidden-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.primary, .secondary, .danger, .ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border-radius: var(--radius); font-weight: 900; cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.compact { min-height: 34px; padding: 6px 10px; font-size: .86rem; }
.primary { color: #fff; background: var(--brand); }
.primary:hover { background: var(--brand-strong); }
.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.secondary:hover { border-color: var(--brand); color: var(--brand); }
.danger { color: #fff; background: var(--danger); }
.ghost { color: var(--brand); background: transparent; }
.product-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.product-actions .primary { min-width: 96px; }
button:disabled { opacity: .58; cursor: not-allowed; }
.summary-box { padding: 14px; border-top: 3px solid var(--brand); }
.summary-line, .cart-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.summary-line:last-child, .cart-line:last-child { border-bottom: 0; }
.total { font-size: 1.2rem; font-weight: 900; }
.notice, .error, .success { padding: 12px; border-radius: var(--radius); }
.notice { border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; }
.error { border: 1px solid #e7b4b4; background: #fff0f0; color: var(--danger); }
.success { border: 1px solid #b7ddc7; background: #edf9f1; color: #145c36; }
.captcha-wrap { grid-column: 1 / -1; min-height: 78px; display: flex; align-items: center; margin-top: 4px; }
.captcha-loading, .captcha-fallback {
  width: min(320px, 100%);
  min-height: 66px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--accent-soft);
  font-size: .86rem;
  font-weight: 800;
}
.captcha-fallback { border-style: solid; color: #475569; background: #f8fafc; }
.empty-state { display: grid; place-items: center; gap: 12px; min-height: 240px; color: var(--muted); text-align: center; }
.loader { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar { display: grid; gap: 10px; }
.login-panel { max-width: 440px; margin: 0 auto; }
.admin-filterbar { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 180px 120px auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.admin-filterbar .primary, .admin-filterbar .secondary { width: auto; white-space: nowrap; }
.report-filterbar {
  grid-template-columns: 210px minmax(240px, 420px) auto;
  justify-content: start;
}
.report-filterbar input, .report-filterbar select { min-height: 40px; }
.product-toolbar { grid-template-columns: minmax(220px, 260px) minmax(240px, 1fr) auto; }
.product-toolbar-edit { grid-template-columns: minmax(180px, 220px) minmax(180px, 1fr) minmax(220px, 1.2fr); }
.product-filter-field input { min-height: 42px; }
.export-actions { justify-content: flex-end; margin-top: 14px; }
.report-columns { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 14px; }
.report-metrics { margin-bottom: 14px; }
.metric strong { display: block; font-size: 1.35rem; }
.admin-layout.wide { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); margin-top: 12px; }
.full { grid-column: 1 / -1; }
.size-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.size-picker legend { padding: 0 6px; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.size-picker label, .detail-block label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 6px; }
.size-picker input, .detail-block input[type="checkbox"] { width: auto; min-height: auto; }
.size-price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.size-price-grid legend { padding: 0 6px; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.size-price-row { display: grid; grid-template-columns: minmax(64px, auto) minmax(130px, 1fr); gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); }
.size-price-row label { display: flex; align-items: center; gap: 6px; font-size: .84rem; }
.size-price-row input[type="number"] { min-width: 130px; min-height: 38px; padding: 7px 9px; font-size: .94rem; }
.file-field input { padding: 7px; }
.image-upload-box { display: grid; gap: 6px; align-content: start; }
.image-upload-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(180px, 1fr);
  gap: 12px 16px;
  align-items: end;
}
.image-upload-preview {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
}
.image-upload-preview .admin-thumb { max-width: 160px; min-height: 96px; height: 96px; }
.image-upload-input { margin: 0; align-self: end; }
.image-upload-row .variant-photo-notice { grid-column: 1 / -1; margin: 0; }
.product-image-disabled-mark {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(189, 31, 45, .92);
  color: #fff;
  font-size: .95rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.image-overridden-by-variants .admin-thumb { opacity: .55; }
.admin-thumb, .admin-product-image { display: grid; place-items: center; width: 100%; min-height: 86px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); cursor: zoom-in; overflow: hidden; }
.admin-thumb { max-width: 180px; }
.admin-thumb.empty { color: var(--muted); cursor: default; font-weight: 800; }
.admin-thumb img, .admin-product-image img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 640px) {
  .image-upload-row { grid-template-columns: 1fr; align-items: start; }
}
.product-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.product-admin-card { display: grid; gap: 8px; align-content: start; min-height: 190px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.product-admin-card.inactive { opacity: .55; }
.product-admin-card .admin-product-image { height: 84px; min-height: 84px; }
.info-flow { display: grid; gap: 10px; padding-left: 22px; line-height: 1.45; }
.state-graph-wrap { width: 100%; overflow-x: auto; margin-top: 18px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.state-graph { display: block; width: min(760px, 100%); min-width: 680px; height: auto; }
.state-graph line { stroke: #65727a; stroke-width: 2.4; }
.state-mail-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px; color: var(--muted); font-size: .82rem; }
.state-mail-legend span { display: inline-flex; gap: 4px; padding: 6px 8px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--line); }
.orders-list { display: grid; gap: 10px; }
.order-row.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(189, 31, 45, .12); }
.detail-block { padding: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.sort-header {
  width: auto;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  box-shadow: none;
}
.sort-header:hover { color: var(--brand); text-decoration: underline; }
.orders-grid table { min-width: 920px; }
.selected-row { background: #fef2f2; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; color: var(--muted); flex-wrap: wrap; }
.catalog-pagination { margin-top: 12px; border-top: 1px solid var(--line); }
.image-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; }
.image-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; background: rgba(31, 36, 40, .54); cursor: zoom-out; }
.image-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  max-height: 88vh;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 36, 40, .28);
}
.image-dialog .section-title { margin-bottom: 10px; }
.image-dialog img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--accent-soft); }

/* Mobile cart bar — shown below 980px when cart has items */
.cart-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cart-bar-info { font-size: .94rem; color: var(--ink); }
.cart-bar-info strong { font-weight: 900; }

@media (max-width: 520px) {
  .shell { padding: 14px 10px 80px; }
  .panel { padding: 14px 12px; }
  .site-header, .admin-header { align-items: stretch; }
  .brand-row { align-items: flex-start; }
  .header-actions { width: 100%; justify-content: stretch; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-knit { padding-bottom: 0; }
  .knit-animation { width: min(340px, 94vw); height: 138px; }
  .catalog-tools { grid-template-columns: 1fr; margin: 12px 0; }
  .catalog-search input { min-height: 48px; }
  .tab { min-height: 48px; padding: 10px 14px; font-size: .98rem; }
  .product-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .product-card { min-height: auto; padding: 12px; gap: 10px; }
  .product-main { grid-template-columns: 72px minmax(0, 1fr); align-items: center; }
  .product-thumb { width: 72px; height: 72px; }
  .product-copy h3 { font-size: 1.02rem; line-height: 1.2; }
  .product-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card input, .product-card select { min-height: 44px; font-size: 1rem; }
  .product-actions .primary, .summary-box .primary { min-height: 48px; }
  .product-actions { justify-content: stretch; }
  .summary-box { margin-top: 2px; }
  .summary-line, .cart-line { align-items: flex-start; flex-direction: column; }
  .primary, .secondary, .danger, .ghost { width: 100%; }
  .done-actions .primary, .done-actions .secondary { width: 100%; }
  .actions { width: 100%; }
  .admin-filterbar, .report-filterbar, .product-toolbar, .admin-layout.wide { grid-template-columns: 1fr; }
  .product-editor-grid { grid-template-columns: 1fr; }
  .product-editor-grid .product-base-price input, .product-editor-grid .product-name-field input { max-width: none; }
  .size-price-grid { grid-template-columns: 1fr; }
  .radio-group { gap: 6px; padding: 10px; }
  .radio-group label { padding: 6px 10px; font-size: .86rem; }
  .cart-bar { display: flex; }
}
@media (max-width: 900px) and (min-width: 521px) {
  .admin-filterbar, .product-toolbar { grid-template-columns: 1fr 1fr; }
  .product-toolbar-edit { grid-template-columns: 1fr 1fr; }
  .report-filterbar { grid-template-columns: 1fr; }
  .admin-layout.wide { grid-template-columns: 1fr; }
  .cart-bar { display: flex; }
}
@media (min-width: 700px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
}
@media (min-width: 1080px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  .site-header { flex-direction: row; align-items: center; justify-content: space-between; }
  .stepper { width: min(520px, 48vw); }
  .admin-layout { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
  .toolbar { grid-template-columns: minmax(240px, 1fr) 160px 180px 120px; align-items: end; }
}
@media (min-width: 980px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .summary-box { position: sticky; top: 18px; }
  .cart-bar { display: none !important; }
}

/* Level filter bar */
.level-filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.level-filter-btn { min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: .82rem; font-weight: 800; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.level-filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.level-filter-btn:hover:not(.active) { border-color: var(--brand); color: var(--brand); }

/* Level badge on product card */
.level-badge { font-size: .68rem; min-height: 18px; padding: 1px 6px; margin-bottom: 2px; display: inline-block; }
.level-badge.level-inicial  { color: #0e6848; background: #d9f4ed; }
.level-badge.level-primaria { color: #15558a; background: #e7f2ff; }
.level-badge.level-secundaria { color: #5c3b8f; background: #f0e9ff; }

/* Out-of-stock badge */
.badge-out-of-stock { color: var(--danger); background: #fff0f0; }

/* Admin stock editor */
.stock-editor-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.stock-editor-section h4 { margin: 0 0 10px; font-size: .82rem; color: var(--muted); text-transform: uppercase; font-weight: 900; letter-spacing: .04em; }
.stock-grid { display: grid; gap: 5px; }
.stock-header, .stock-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; padding: 5px 8px; }
.stock-grid.has-variants .stock-header, .stock-grid.has-variants .stock-row { grid-template-columns: 90px 120px 1fr; }
.stock-header { color: var(--muted); font-size: .75rem; font-weight: 900; text-transform: uppercase; }
.stock-row { border: 1px solid var(--line); border-radius: 6px; background: var(--accent-soft); }
.stock-qty-input { max-width: 90px; min-height: 34px; padding: 5px 8px; font-size: .9rem; }

/* Product variants with photo */
.variant-editor { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.variant-editor-help { margin: 0 0 8px; font-size: .84rem; }
.variant-block {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.variant-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 96px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 0;
}
.variant-name-field { display: grid; gap: 4px; margin: 0; font-size: .78rem; color: var(--muted); text-transform: uppercase; font-weight: 800; }
.variant-name-field input { min-height: 40px; padding: 8px 10px; font-size: .95rem; }
.variant-image-field { display: grid; place-items: center; min-height: 96px; }
.variant-image-preview { width: 96px; min-height: 96px; height: 96px; padding: 0; margin: 0; }
.variant-image-preview.is-default { opacity: .85; }
.variant-image-preview.empty {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: .7rem;
  text-align: center;
  line-height: 1.2;
}
.variant-file-field { margin: 0; font-size: .82rem; align-self: end; }
.variant-file-field input { padding: 8px; min-height: 40px; width: 100%; }
.variant-remove-btn { align-self: end; min-height: 40px; }
.product-name-field { max-width: 320px; }
.variant-sizes-block { display: grid; gap: 4px; margin-top: 4px; }
.variant-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 4px;
}
.variant-size-row {
  display: grid;
  grid-template-columns: 56px minmax(72px, 1fr) 64px;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
}
.variant-size-check { display: flex; align-items: center; gap: 4px; margin: 0; font-size: .8rem; font-weight: 700; }
.variant-size-check span { white-space: nowrap; }
.variant-size-row input[type="number"] { min-height: 30px; padding: 4px 6px; font-size: .84rem; }
.product-level-field { display: grid; gap: 4px; }
.product-image-field { display: grid; gap: 8px; align-content: start; }
.product-image-row {
  grid-template-columns: minmax(220px, 1fr) 112px;
  align-items: center;
  max-width: 420px;
}
.product-image-row .image-upload-input { align-self: center; }
.product-image-row .image-upload-preview { justify-items: end; }
.product-image-field .admin-thumb {
  width: 112px;
  height: 112px;
  max-width: 112px;
  min-height: 112px;
}
.product-image-field .admin-thumb.is-default { opacity: .75; }
@media (max-width: 640px) {
  .product-image-row {
    grid-template-columns: 1fr 96px;
    max-width: none;
  }
  .product-image-field .admin-thumb {
    width: 96px;
    height: 96px;
    max-width: 96px;
    min-height: 96px;
  }
}
.field-hint { font-size: .78rem; line-height: 1.35; }
@media (max-width: 720px) {
  .variant-row { grid-template-columns: 1fr auto; }
  .variant-name-field { grid-column: 1 / -1; }
  .variant-file-field { grid-column: 1 / -1; }
  .product-name-field { max-width: none; }
}
.variant-image-dot {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.stock-row span:nth-child(2) { display: inline-flex; align-items: center; gap: 8px; }

.school-levels-editor { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.school-levels-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.school-level-row, .school-level-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.school-level-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }

/* Productos generales + alertas admin */
.badge-general { color: #7a4a00; background: #fff3d6; border: 1px solid #f0d59a; }
.badge-alert-new { color: #8a1f1f; background: #ffe4e4; }
.help-banner { display: grid; gap: 6px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #fffdf8, #f7f3ea); }
.help-banner p { margin: 0; color: var(--ink); font-size: .92rem; }
.product-type-picker { display: grid; gap: 12px; }
.product-type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.product-type-card { display: grid; gap: 8px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); cursor: pointer; }
.product-type-card:hover { border-color: var(--brand); }
.product-type-card.selected { border-color: var(--brand); background: #f3faf6; box-shadow: inset 0 0 0 1px var(--brand); }
.product-mode-picker { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.product-mode-picker h3 { margin: 0 0 6px; }
.product-mode-hint, .product-create-hint { margin: 8px 0 0; }
.product-work-picker { background: #fbfaf7; }
.product-toolbar .product-create-hint { margin: 0; align-self: center; }
.product-type-card strong { font-size: 1rem; }
.product-type-card span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.general-schools-field { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.general-schools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.general-school-option { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.product-card-title-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stock-shared-notice, .notice { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; background: #fff8e8; border: 1px solid #f0d59a; color: #6a4b10; font-size: .9rem; }
.alerts-list { display: grid; gap: 10px; }
.alert-item { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.alert-item.unseen { border-color: #e7b0b0; background: #fff7f7; box-shadow: inset 3px 0 0 #d64545; }
.alert-item.seen { opacity: .85; }
.alert-item-main { display: grid; gap: 6px; flex: 1; }
.alert-item-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert-item-link { display: grid; gap: 4px; text-align: left; padding: 0; border: 0; background: transparent; cursor: pointer; color: inherit; }
.alert-item-link:hover strong { text-decoration: underline; }
.alert-popup-card, .general-confirm-card, .product-preview-card { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; text-align: left; }
.product-preview-meta { display: grid; gap: 8px; margin-bottom: 14px; }
.product-preview-storefront { padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: #f7f8f5; margin-bottom: 14px; }
.preview-storefront-label { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 900; }
.product-preview-mock { max-width: 360px; margin: 0 auto; background: #fff; }
.product-preview-mock .product-thumb {
  width: 72px;
  height: 72px;
  min-height: 72px;
}
.product-preview-mock .product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.variant-photo-notice { margin-top: 8px; }
.center-alert-overlay { z-index: 80; }
.center-alert-card { width: min(480px, calc(100vw - 24px)); text-align: center; }
.center-alert-card h3 { margin: 0 0 10px; }
.center-alert-card p { margin: 0 0 16px; color: var(--ink); line-height: 1.45; }
.confirm-dialog-card { width: min(520px, calc(100vw - 24px)); }
.confirm-dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.confirm-dialog-actions .ghost,
.confirm-dialog-actions .primary,
.confirm-dialog-actions .danger { width: auto; min-width: 140px; }
.product-editor-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.product-editor-actions > button {
  width: auto;
  min-height: 44px;
  padding: 10px 16px;
  font-size: .95rem;
}
.alert-popup-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.alert-popup-list button { width: 100%; display: grid; gap: 4px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.alert-popup-list button:hover { border-color: var(--brand); }
.general-confirm-preview { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.general-confirm-preview img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--accent-soft); }
.general-confirm-schools ul { margin: 6px 0 12px; padding-left: 18px; }

/* Pedidos vendidos sin stock */
.badge-no-stock {
  color: #fff;
  background: #bd1f2d;
  border: 1px solid #8f1722;
  font-weight: 1000;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.order-detail-badges { display: grid; gap: 6px; justify-items: end; }
.stock-alert-banner {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #8f1722;
  border-radius: var(--radius);
  color: #fff;
  background: #bd1f2d;
}
.stock-alert-title { font-size: 1.05rem; font-weight: 1000; letter-spacing: .06em; }
.stock-alert-banner p { margin: 0; font-size: .9rem; }
.stock-alert-banner ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .88rem; }
.order-actions-block { display: grid; gap: 10px; align-content: start; }
.order-action-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.order-action-buttons > button { width: auto; min-height: 44px; padding: 10px 16px; }

/* Asistente de confirmación / cancelación de pedidos */
.order-wizard-overlay { z-index: 90; }
.order-wizard-card {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  display: grid;
  justify-items: stretch;
  gap: 12px;
  overflow-y: auto;
  text-align: left;
}
.order-wizard-card .section-title { width: 100%; }
.order-wizard-card p { text-align: left; font-weight: 500; }
.order-wizard-stock-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88rem; font-weight: 800; color: #8f1722; }
.order-wizard-body { display: grid; gap: 14px; }
.order-wizard-fieldset { display: grid; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf8; }
.order-wizard-fieldset legend { padding: 0 6px; font-size: .8rem; font-weight: 900; text-transform: uppercase; color: var(--muted); }
.cart-school-title,
.order-school-group-title { margin: 14px 0 8px; font-size: .95rem; font-weight: 800; color: var(--brand, #8f1722); }
.cart-school-group:first-child .cart-school-title,
.order-school-group-title:first-child { margin-top: 0; }
.order-wizard-items th, .order-wizard-items td { vertical-align: middle; }
.wizard-qty-input { max-width: 80px; min-height: 34px; padding: 5px 8px; font-size: .9rem; }
.order-wizard-totals { display: grid; gap: 4px; }
.order-wizard-notes { display: grid; gap: 6px; font-weight: 900; }
.order-wizard-notes textarea { min-height: 90px; }
.order-wizard-contact-readonly p { margin: 0 0 6px; }
.order-wizard-contact-readonly p:last-child { margin-bottom: 0; }
.order-wizard-actions > button { width: auto; min-height: 44px; padding: 10px 16px; }
.email-preview {
  max-height: 340px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid #eadfc4;
  border-radius: var(--radius);
  background: #fffaf0;
}
.email-preview-doc { display: grid; gap: 10px; font-size: .9rem; }
.email-preview-doc p { margin: 0; }
.email-preview-subject { color: var(--muted); }
.email-preview-data { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: .88rem; }
.email-preview-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.email-preview-table th { text-align: left; padding: 7px 8px; background: #fff1a6; color: #8f1722; font-size: .74rem; text-transform: uppercase; }
.email-preview-table td { padding: 7px 8px; border-bottom: 1px solid #eadfc4; }
.email-preview-totals { display: grid; gap: 4px; }
.email-preview-banking { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid #eadfc4; border-radius: 6px; background: #fff; font-size: .88rem; }
.email-preview-notes { display: grid; gap: 4px; font-size: .88rem; }
.size-guide-preview { display: grid; }
