/* ============================================================
   Personalizador de producto con Fabric.js — estilos
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1e2330;
  --muted: #6b7280;
  --line: #e6e8ec;
  --brand: #002855;
  --brand-dark: #001b3d;
  --cta: #FF5500;
  --cta-dark: #e04b00;
  --danger: #e5484d;
  --rail: #1f2430;
  --rail-ink: #c7ccd8;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* el atributo hidden debe ganar a display:grid/flex */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ------------------------- Barra superior ------------------------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.topbar__brand strong { color: var(--brand); }
.logo-dot { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--brand), var(--cta)); }
.topbar__center { display: flex; align-items: center; gap: 4px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }

/* Franja informativa de precio por unidad y tramo (centrada entre zoom y carrito) */
.tier-prices { display: flex; align-items: center; justify-content: center; gap: 14px;
  flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tier-prices .tier { display: inline-flex; align-items: baseline; gap: 6px; }
.tier-prices .tier + .tier { border-left: 1px solid var(--line); padding-left: 14px; }
.tier-prices .tier-range { color: var(--muted); }
.tier-prices .tier-price { color: var(--ink); font-weight: 600; }

.tbtn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--ink);
}
.tbtn:hover { background: #eef1f6; }
.tbtn:disabled { opacity: .35; cursor: not-allowed; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }

/* Botón único ampliar/desampliar: alterna el icono (lupa +/−) según el estado */
#btn-zoom-toggle .zoom-ico--out { display: none; }
#btn-zoom-toggle.is-on .zoom-ico--in { display: none; }
#btn-zoom-toggle.is-on .zoom-ico--out { display: block; }
#btn-zoom-toggle.is-on { background: #eef1f6; color: var(--brand); }

.btn {
  height: 40px; padding: 0 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn--primary { background: var(--cta); color: #fff; }
.btn--primary:hover { background: var(--cta-dark); }
.cart-ico { display: none; width: 18px; height: 18px; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: #f5f7fb; }

/* ------------------------- Workspace ------------------------- */
.workspace { flex: 1; display: flex; min-height: 0; }

/* Rail de iconos */
.rail {
  width: 82px; background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column; padding: 8px 0; gap: 2px;
}
.rail__item {
  background: transparent; border: 0; color: var(--rail-ink);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 4px; font-size: 11px; border-left: 3px solid transparent;
}
.rail__item:hover { background: #2a3040; color: #fff; }
.rail__item.is-active { background: #2a3040; color: #fff; border-left-color: var(--cta); }
.rail__item svg { width: 22px; height: 22px; }

/* Panel lateral */
.side {
  width: 300px; background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 18px;
}
.panel { display: none; }
.panel.is-active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel__title { font-size: 16px; margin: 0 0 14px; }
.panel__sub { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 20px 0 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0; line-height: 1.5; }

.big-action {
  display: block; width: 100%; text-align: center;
  padding: 14px; border-radius: 10px; border: 2px dashed #c9d2e3;
  background: #f7f9ff; color: var(--brand); font-weight: 600; font-size: 14px;
}
.big-action:hover { background: #eef3ff; border-color: var(--brand); }
.big-action--sm { padding: 11px; font-size: 13px; }
.preset-pos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.quick-texts { display: grid; gap: 8px; margin-top: 14px; }
.quick-text {
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 16px; color: var(--ink); text-align: center;
}
.quick-text:hover { border-color: var(--brand); background: #f7f9ff; }

/* Rejillas de miniaturas */
.thumb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.thumb-grid img, .thumb {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  aspect-ratio: 1; width: 100%; object-fit: contain; padding: 8px; display: grid; place-items: center;
}
.thumb-grid img:hover { border-color: var(--brand); cursor: pointer; }
.thumb svg { width: 40px; height: 40px; }
.thumb-wrap { position: relative; }
.thumb-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 6px;
  border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; display: none; place-items: center;
}
.thumb-wrap:hover .thumb-del { display: grid; }

/* Swatches de color de producto */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--brand); }

/* ------------------------- Escenario ------------------------- */
.stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; padding: 20px; min-width: 0;
  background:
    radial-gradient(circle at 50% 40%, #ffffff, #eceef3 80%);
}
.stage__canvas-wrap {
  position: relative;
  box-shadow: var(--shadow); border-radius: 8px; background: #fff; overflow: hidden;
}
.canvas-container { border-radius: 8px; }
.size-badge {
  position: absolute; right: 12px; bottom: 12px; pointer-events: none;
  background: rgba(255, 255, 255, .92); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: 13px; font-weight: 700; line-height: 1;
}
.size-badge:empty { display: none; }

.sides { display: flex; gap: 10px; margin-top: 18px; }
.side-tab {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 76px;
}
.side-tab img { width: 54px; height: 54px; object-fit: contain; }
.side-tab span { font-size: 12px; color: var(--muted); }
.side-tab.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(0,40,85,.15); }
.side-tab.is-active span { color: var(--brand); font-weight: 600; }

.stage__note { position: absolute; bottom: 12px; left: 16px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.stage__note .dot { width: 22px; height: 0; border-top: 2px dashed #9aa3b2; }

/* ------------------------- Panel de propiedades ------------------------- */
.props {
  width: 300px; background: var(--panel); border-left: 1px solid var(--line);
  overflow-y: auto; padding: 18px;
}
.props__empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.props__empty svg { width: 46px; height: 46px; opacity: .35; margin-bottom: 12px; }
.props__empty p { font-size: 13px; line-height: 1.5; }

.props__actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 18px;
}
.oaction {
  height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  display: grid; place-items: center;
}
.oaction:hover { background: #f5f7fb; border-color: #cdd4e0; }
.oaction svg { width: 18px; height: 18px; }
.oaction--danger { color: var(--danger); }
.oaction.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }

.props__group { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.props__group:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.props__group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 12px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field em { color: var(--ink); font-style: normal; float: right; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,40,85,.12); }
textarea { resize: vertical; margin-bottom: 12px; }
input[type="color"] { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
.field.checkbox { display: flex; align-items: center; gap: 8px; }
.field.checkbox span { margin: 0; }
.field.checkbox input { width: auto; }

/* Toggles de Nombre y número */
.ph-toggle { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; cursor: pointer; }
.ph-toggle:hover { border-color: var(--brand); background: #f7f9ff; }
.ph-toggle span { font-size: 14px; color: var(--ink); }
.ph-toggle input { width: 18px; height: 18px; accent-color: var(--brand); }

.btn-row { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.toggle {
  min-width: 38px; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  display: grid; place-items: center; font-size: 15px;
}
.toggle:hover { background: #f5f7fb; }
.toggle.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.toggle svg { width: 16px; height: 16px; }

/* ------------------------- Modal ------------------------- */
.modal { position: fixed; inset: 0; background: rgba(15,20,30,.55); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal__box { background: #fff; border-radius: 16px; padding: 26px; width: min(620px, 100%); max-height: 92vh; overflow-y: auto; position: relative; box-shadow: var(--shadow); }
.modal__box h2 { margin: 0 0 18px; font-size: 20px; }
.modal__close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border: 0; background: #f1f3f7; border-radius: 9px; font-size: 15px; }
.modal__previews { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; min-height: 60px; }
.modal__previews img { width: 150px; height: 150px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.modal__cap { text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal__loading { padding: 20px; font-size: 13px; color: var(--muted); }
.modal__ph { width: 150px; height: 150px; display: grid; place-items: center; font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; background: #fafbfc; }
.modal__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal__row .field { margin: 0; width: 120px; }
.modal__row--total { align-items: center; margin: 18px 0 4px; }
.modal__row--total .btn { flex: 0 0 auto; }
.modal__price { font-size: 15px; }
.modal__price strong { font-size: 20px; color: var(--brand); }
.field.checkbox.review-toggle { align-items: flex-start; gap: 10px; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; background: var(--panel); cursor: pointer; margin: 10px 0 0; }
.field.checkbox.review-toggle:hover { border-color: var(--brand); background: #f7f9ff; }
.field.checkbox.review-toggle input { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 1px; flex: 0 0 auto; }
.field.checkbox.review-toggle span { display: flex; flex-direction: column; gap: 2px; }
.review-toggle strong { font-size: 14px; color: var(--ink); }
.review-toggle small { font-size: 12px; color: var(--muted); }

/* ---- Pedido: tallas y archivo ---- */
.order-block { margin-bottom: 14px; }
.size-run { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.size-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.size-row__label { font-weight: 600; font-size: 13px; width: 34px; }
.size-row .size-qty { width: 100%; padding: 6px 8px; }
.order-file__drop { display: grid; place-items: center; text-align: center; }
.order-file__drop span { pointer-events: none; }

/* Estado del procesado del archivo (IA) */
.order-status { margin-top: 10px; padding: 9px 12px; border-radius: 9px; font-size: 13px;
  background: #eef3ff; color: var(--brand); border: 1px solid #d6e0f5; }
.order-status--busy::before { content: '⏳ '; }
.order-status--error { background: #fdecec; color: #a3282c; border-color: #f4c9cb; }

/* Desglose de prendas devuelto por la IA */
.order-summary { margin-top: 12px; }
.order-summary__scroll { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.order-summary table { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-summary th, .order-summary td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.order-summary thead th { position: sticky; top: 0; background: #f7f9ff; color: var(--muted);
  font-weight: 600; font-size: 12px; }
.order-summary tbody tr:last-child td { border-bottom: 0; }
.order-summary__totals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.size-chip { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #eef1f6;
  color: var(--ink); font-size: 12px; font-weight: 600; }
.size-chip--total { background: var(--brand); color: #fff; margin-left: auto; }
.order-summary__warn { margin-top: 8px; font-size: 12px; color: #a3742a; }
.order-summary__warn--err { color: var(--danger); font-weight: 600; }
.size-err, .cell-err { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(229, 72, 77, .12);
  color: var(--danger); font-weight: 700; font-size: 12px; }
.order-row--err td { background: rgba(229, 72, 77, .05); }

/* Cabecera del resumen con botón Editar */
.order-summary__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.order-summary__title { font-size: 13px; font-weight: 600; color: var(--muted); }
.btn--sm { padding: 5px 12px; font-size: 12px; }

/* Modal de edición del pedido */
.modal__box--edit { width: min(680px, 100%); }
.edit-head { display: grid; gap: 8px; padding: 2px 4px 6px; font-size: 12px; color: var(--muted); }
.edit-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; padding: 2px; }
.edit-row { display: grid; gap: 8px; align-items: center; }
.edit-row input, .edit-row select { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.edit-row input.is-err, .edit-row select.is-err { border-color: var(--danger); background: rgba(229, 72, 77, .06); }
.edit-del { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; line-height: 1; }
.edit-del:hover { border-color: var(--danger); color: var(--danger); }
#edit-add { width: 100%; margin-top: 10px; }
.edit-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.edit-actions { display: flex; gap: 10px; }
.edit-status { font-size: 13px; color: var(--muted); }
.edit-status--err { color: var(--danger); font-weight: 600; }

.priority-group { display: flex; gap: 8px; margin-bottom: 4px; }
.priority-btn { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--ink); font: inherit; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s; }
.priority-btn:hover { border-color: var(--brand); }
.priority-btn.is-active { border-color: var(--brand); background: rgba(0, 40, 85, .06); box-shadow: inset 0 0 0 1px var(--brand); }
.priority-btn__title { font-weight: 700; font-size: 13px; }
.priority-btn__sub { font-size: 11px; color: var(--muted); }
.priority-btn.is-active .priority-btn__sub { color: var(--brand); }
.modal__actions { display: flex; gap: 10px; }
.modal__actions .btn { flex: 1; }
.modal__note { font-size: 12px; color: var(--muted); margin: 14px 0 0; text-align: center; }

.modal__print { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 16px; }
.modal__print .field { margin-bottom: 10px; }
.btn--print { width: 100%; }
.print-info { font-size: 12px; color: var(--muted); margin: 8px 0 0; text-align: center; }

/* Vista de pedido completado */
.order-done__msg { text-align: center; padding: 8px 0 18px; }
.order-done__title { font-size: 18px; font-weight: 800; color: var(--brand); }
.order-done__sub { font-size: 14px; color: var(--ink); margin-top: 6px; }
.order-done__hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.order-done__review { font-size: 13px; color: var(--brand); font-weight: 600; margin-top: 8px; }
.modal__row--done { margin-top: 16px; }
.modal__row--done .btn { width: 100%; }

/* ------------------------- Toast ------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 200; animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------- Chrome móvil (oculta en escritorio) ------------------------- */
.sheet-head { display: none; }
.sheet-backdrop { display: none; }
.fab { display: none; }

/* ------------------------- Responsive ------------------------- */
@media (max-width: 1100px) {
  .props { width: 264px; }
  .side { width: 264px; }
}

@media (max-width: 820px) {
  /* --- Barra superior compacta --- */
  .topbar { height: 52px; padding: 0 10px; gap: 4px; overflow: hidden; }
  .topbar__brand { font-size: 0; flex: none; }   /* oculta el texto, deja el punto */
  .topbar__center { margin: 0 auto 0 0; gap: 0; min-width: 0; }
  .topbar__center .sep { display: none; }
  .tier-prices { display: none; }   /* no cabe en móvil; el precio está en el carrito */
  .topbar__actions { min-width: 0; }
  .tbtn { width: 32px; height: 32px; }
  .btn { height: 36px; padding: 0 12px; font-size: 13px; }
  .cart-txt { display: none; }
  .cart-ico { display: inline-block; }
  #btn-cart { padding: 0 14px; }

  /* --- Estructura en columna, lienzo a pantalla completa --- */
  .workspace { flex-direction: column; padding-bottom: 62px; }
  .stage { order: 1; flex: 1 1 auto; min-height: 0; padding: 8px; }
  .sides { margin-top: 8px; }
  .side-tab { min-width: 62px; padding: 6px; }
  .side-tab img { width: 40px; height: 40px; }
  .stage__note { display: none; }

  /* --- Rail -> barra de navegación inferior --- */
  .rail {
    order: 3; position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; height: 60px; flex-direction: row; padding: 0;
    justify-content: space-around; z-index: 50;
  }
  .rail__item {
    flex: 1; min-width: 0; border-left: 0; border-top: 3px solid transparent;
    padding: 7px 2px 6px; font-size: 10px; gap: 3px;
  }
  .rail__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail__item.is-active { border-left-color: transparent; border-top-color: var(--cta); }

  /* --- Paneles como hojas inferiores (bottom sheets) --- */
  .side, .props {
    position: fixed; left: 0; right: 0; bottom: 60px; width: auto;
    max-height: 60vh; border: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(16, 24, 40, .22);
    transform: translateY(120%); transition: transform .26s ease;
    z-index: 48; padding: 0 16px 20px;
  }
  .side.sheet-open, .props.sheet-open { transform: translateY(0); }

  .sheet-head {
    display: flex; align-items: center; justify-content: center;
    position: sticky; top: 0; z-index: 2; background: var(--panel);
    padding: 10px 0 8px; margin: 0 -16px 4px;
  }
  .sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: #d3d8e0; }
  .sheet-close {
    position: absolute; right: 10px; top: 7px; width: 30px; height: 30px;
    border: 0; border-radius: 8px; background: #f1f3f7; color: var(--ink);
    font-size: 14px; display: grid; place-items: center;
  }

  /* --- Fondo oscurecido tras la hoja --- */
  .sheet-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(15, 20, 30, .35);
    opacity: 0; pointer-events: none; transition: opacity .26s ease; z-index: 46;
  }
  .sheet-backdrop.show { opacity: 1; pointer-events: auto; }

  /* --- Botón flotante "Editar" --- */
  .fab {
    display: inline-flex; align-items: center; gap: 7px;
    position: fixed; right: 14px; bottom: 72px; z-index: 47;
    height: 46px; padding: 0 18px; border: 0; border-radius: 24px;
    background: var(--cta); color: #fff; font-weight: 600; font-size: 14px;
    box-shadow: 0 6px 18px rgba(255, 85, 0, .45);
  }
  .fab svg { width: 18px; height: 18px; }

  /* --- Objetivos táctiles mayores en las rejillas --- */
  .thumb-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-text { padding: 14px; }
  .modal__box { padding: 20px; }
  .modal__previews img { width: 120px; height: 120px; }
}

@media (max-width: 380px) {
  .rail__item span { font-size: 9px; }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
}
