.tag-layout-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}

.tag-layout-presets button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid #cbdad8;
  border-radius: 10px;
  background: #fff;
  color: #274644;
  text-align: left;
}

.tag-layout-presets button:hover,
.tag-layout-presets button.active {
  border-color: #07847d;
  background: #e9f5f3;
  box-shadow: 0 0 0 2px #d3ece8;
}

.tag-layout-presets span,
.tag-layout-presets b,
.tag-layout-presets small {
  display: block;
}

.tag-layout-presets small {
  margin-top: 2px;
  color: #71817f;
  font-size: 9px;
}

.layout-swatch {
  position: relative;
  flex: 0 0 54px;
  height: 34px;
  overflow: hidden;
  border: 1px solid #0b3568;
  border-radius: 6px;
  background: #fff;
}

.layout-swatch::before,
.layout-swatch::after {
  content: "";
  position: absolute;
  top: 0;
  height: 4px;
}

.layout-swatch::before { left: 0; width: 45%; background: #0b3568; }
.layout-swatch::after { right: 0; width: 28%; background: #efa31b; }
.layout-swatch.clean { border-color: #cad6df; border-radius: 2px; }
.layout-swatch.clean::before,
.layout-swatch.clean::after { display: none; }
.layout-swatch.stripe::before { width: 100%; height: 8px; }
.layout-swatch.stripe::after { width: 28%; height: 8px; }

.tag-design-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}

.tag-design-grid .field { margin: 0; }
.tag-color-field > div { display: flex; align-items: center; gap: 8px; }
.tag-color-field input[type="color"] { width: 48px; height: 39px; padding: 3px; border: 1px solid #c8d9d7; border-radius: 8px; background: #fff; }
.tag-color-field span { color: #607270; font-size: 10px; font-weight: 700; }

.tag-range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 16px 0 10px;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f4f8f7;
}

.tag-range-grid label > span { display: flex; justify-content: space-between; margin-bottom: 6px; color: #355452; font-size: 10px; }
.tag-range-grid input { width: 100%; accent-color: #087d78; }

.tag-preview-tag {
  --tag-primary: #0b3568;
  --tag-accent: #efa31b;
  --tag-background: #fff;
  border-color: var(--tag-primary);
  border-radius: var(--tag-radius, 6px);
  background: var(--tag-background);
}

.tag-preview-tag::before { background: var(--tag-primary); }
.tag-preview-tag::after { background: var(--tag-accent); }
.tag-preview-title { color: var(--tag-primary); }
.tag-preview-rule { background: var(--tag-accent); }
.tag-preview-subtitle { color: var(--tag-primary); }
.tag-preview-tag.align-left,
.tag-preview-tag.align-left .tag-preview-main,
.tag-preview-tag.align-left .tag-preview-detail { text-align: left; }
.tag-preview-tag.align-left .tag-preview-brand { justify-content: flex-start; padding-left: 5%; }
.tag-preview-tag.align-left .tag-preview-rule { margin-left: 0; }
.tag-preview-tag.border-none { border: 0; box-shadow: none; }
.tag-preview-tag.template-clean { box-shadow: inset 0 0 0 1px #d8e0e7; }
.tag-preview-tag.template-clean::before,
.tag-preview-tag.template-clean::after { display: none; }
.tag-preview-tag.template-stripe::before { width: 100%; height: 8%; }
.tag-preview-tag.template-stripe::after { width: 28%; height: 8%; }
.tag-preview-tag.logo-hidden .tag-preview-brand { display: none; }
.tag-preview-tag.logo-left { grid-template-columns: 25% 1fr; grid-template-rows: 1fr auto; }
.tag-preview-tag.logo-left .tag-preview-brand { grid-row: 1 / 3; align-items: center; padding: 0 5%; }
.tag-preview-tag.logo-left .tag-preview-main { padding-left: 0; }
.tag-preview-tag.template-clean.border-none { box-shadow: none; }

.tag-source-panel[hidden],
.tag-standard-section[hidden] { display: none !important; }

.tag-source-tabs { grid-template-columns: repeat(4, 1fr); }

.tag-annotation-reference {
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 18px;
  align-items: center;
  padding: 15px;
  border: 1px solid #d4e2e8;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbfd, #eef6fa);
}

.tag-annotation-reference img {
  width: 112px;
  height: auto;
  border: 1px solid #c7d5df;
  border-radius: 8px;
  box-shadow: 0 5px 14px #173b6320;
}

.tag-annotation-reference span,
.tag-annotation-reference b,
.tag-annotation-reference strong,
.tag-annotation-reference small { display: block; }
.tag-annotation-reference span { color: #d39417; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.tag-annotation-reference b { margin-top: 4px; color: #123b69; font-size: 18px; }
.tag-annotation-reference strong { margin: 5px 0; color: #08766f; font-size: 14px; }
.tag-annotation-reference small { max-width: 420px; color: #637775; line-height: 1.45; }

.tag-annotation-controls {
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.tag-annotation-controls .field { margin: 0; }
.tag-annotation-total { display: grid; min-height: 42px; align-content: center; padding: 6px 12px; border-radius: 9px; background: #e8f3f1; }
.tag-annotation-total span { color: #6d807e; font-size: 9px; }
.tag-annotation-total b { color: #075f5a; font-size: 13px; }

.annotation-preview-sheet {
  position: relative;
  display: block !important;
}

.annotation-preview-tag {
  position: absolute;
  width: 168px;
  height: 258px;
  border: 1px solid #697b8c;
  background: #fff;
  overflow: hidden;
}

.annotation-preview-tag img { display: block; width: 100%; height: 100%; object-fit: fill; }
.annotation-tag-1 { left: 19px; top: 72px; }
.annotation-tag-2 { left: 19px; top: 337px; }
.annotation-tag-3,
.annotation-tag-4,
.annotation-tag-5 { left: 194px; width: 258px; height: 168px; }
.annotation-tag-3 { top: 72px; }
.annotation-tag-4 { top: 247px; }
.annotation-tag-5 { top: 422px; }
.annotation-tag-3 img,
.annotation-tag-4 img,
.annotation-tag-5 img { width: 168px; height: 258px; transform: translate(258px, 0) rotate(90deg); transform-origin: top left; }
.annotation-preview-tag::after { content: "CORTE"; position: absolute; right: 3px; bottom: 2px; padding: 1px 3px; background: #fff; color: #80909e; font-size: 6px; letter-spacing: .06em; }

@media (max-width: 760px) {
  .tag-source-tabs,
  .tag-layout-presets,
  .tag-design-grid,
  .tag-range-grid { grid-template-columns: 1fr; }
  .tag-annotation-reference,
  .tag-annotation-controls { grid-template-columns: 1fr; }
}
