.pm-plantillas {
.templates-page {
    height: calc(100vh - 3.4rem);
    margin: -1.25rem -1.5rem -2rem;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background: #dfe9f3;
    color: #001a35;
}

.templates-titlebar {
    min-height: 4.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid #b6c7d8;
    background: #eef4fb;
}

.templates-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.templates-title h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 900;
}

.template-title-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(#ffffff, #d8e3ec);
    border: 1px solid #9db0c0;
    position: relative;
}

.template-title-icon::before {
    content: "";
    position: absolute;
    inset: 0.35rem;
    background: #7b8792;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2h9l5 5v15H6V2Zm8 1.5V8h4.5L14 3.5ZM8 11h9v1.5H8V11Zm0 4h9v1.5H8V15Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2h9l5 5v15H6V2Zm8 1.5V8h4.5L14 3.5ZM8 11h9v1.5H8V11Zm0 4h9v1.5H8V15Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.templates-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.template-action {
    min-height: 1.95rem;
    padding: 0 0.9rem;
    border: 1px solid #8aa5bc;
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 900;
}

.template-action:hover,
.template-action:focus-visible {
    color: #111827;
    background: linear-gradient(#ffffff, #d8e7f2) !important;
}

.action-new { background: #54afe3; }
.action-open { background: #f28a2e; }
.action-save { background: #1fac5a; }
.action-preview { background: #743ddd; }
.action-delete { background: #e87670; }
.action-list { background: #ee8429; }
.action-close { background: #dc1f26; }
.action-help {
    min-width: 2.25rem;
    width: 2.25rem;
    padding: 0;
    border-radius: 50%;
    background: transparent url('/icons/ayuda.png') center / 28px 28px no-repeat;
    color: transparent;
    font-size: 0;
    box-shadow: 0 5px 12px rgba(13, 45, 73, .18);
}

.template-action.action-new,
.template-action.action-open,
.template-action.action-save,
.template-action.action-preview,
.template-action.action-delete,
.template-action.action-list,
.template-action.action-close {
    min-width: 2.5rem;
    width: 2.5rem;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
    color: transparent;
    font-size: 0;
    background-color: #ffffff;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 1.65rem 1.65rem;
}

.template-action.action-new {
    background-image: url('/icons/actions/white/new.svg');
}

.template-action.action-open {
    background-image: url('/icons/actions/white/open.svg');
}

.template-action.action-preview {
    background-image: url('/icons/actions/white/preview.svg');
}

.template-action.action-save {
    background-image: url('/icons/actions/white/save.svg');
}

.template-action.action-delete {
    background-image: url('/icons/actions/white/delete.svg');
}

.template-action.action-list {
    background-image: url('/icons/actions/white/print.svg');
}

.template-action.action-close {
    background-image: url('/icons/actions/white/close.svg');
}

.template-action.action-new:hover,
.template-action.action-open:hover,
.template-action.action-save:hover,
.template-action.action-preview:hover,
.template-action.action-delete:hover,
.template-action.action-list:hover,
.template-action.action-close:hover,
.template-action.action-new:focus-visible,
.template-action.action-open:focus-visible,
.template-action.action-save:focus-visible,
.template-action.action-preview:focus-visible,
.template-action.action-delete:focus-visible,
.template-action.action-list:focus-visible,
.template-action.action-close:focus-visible {
    color: transparent;
}

.template-message {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #c5d4e2;
    background: #fff8d7;
    color: #384b5a;
    font-weight: 700;
}

.template-editor-shell {
    min-height: 0;
    overflow: hidden;
    display: block;
}

.template-action-cell {
    width: 42px;
    min-width: 42px;
    text-align: center !important;
}

.template-workspace {
    min-width: 0;
    min-height: 0;
    display: grid;
    height: 100%;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.template-meta {
    display: grid;
    grid-template-columns: minmax(300px, 430px) minmax(420px, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 0.45rem 0.9rem;
    background: #f5f8fb;
    border-bottom: 1px solid #c4d2df;
}

.template-meta label,
.template-formatbar label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.template-meta label {
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
}

.template-formatbar {
    min-height: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #c4d2df;
    background: #eaf2fb;
}

.template-formatbar label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.compact-select {
    min-width: 7.5rem;
    min-height: 1.8rem;
    padding-block: 0.15rem;
}

.paper-size-select {
    min-width: 9rem;
}

.compact-number {
    width: 4.7rem;
    min-height: 1.8rem;
    padding-block: 0.15rem;
}

.header-footer-number {
    width: 4.6rem;
}

.format-button,
.image-input-button {
    min-height: 1.95rem;
    padding: 0 0.65rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid #9ab1c3;
    border-radius: 4px;
    background: linear-gradient(#ffffff, #dbe8f2);
    color: #0d3154;
    font-size: 0.78rem;
    font-weight: 900;
}

.format-button.strong { font-weight: 900; }
.format-button.italic { font-style: italic; }
.format-button.underline { text-decoration: underline; }

.align-button {
    width: 2.25rem;
    padding-inline: 0;
}

.align-icon {
    display: block;
    width: 1.15rem;
    height: 0.95rem;
    background:
        linear-gradient(#0d3154, #0d3154) left 0 top 0 / var(--line-1, 100%) 2px no-repeat,
        linear-gradient(#0d3154, #0d3154) left var(--line-left-2, 0) top 5px / var(--line-2, 72%) 2px no-repeat,
        linear-gradient(#0d3154, #0d3154) left 0 bottom 0 / var(--line-3, 100%) 2px no-repeat;
}

.align-left-icon {
    --line-1: 100%;
    --line-2: 68%;
    --line-3: 86%;
}

.align-center-icon {
    --line-1: 100%;
    --line-2: 68%;
    --line-3: 86%;
    --line-left-2: 16%;
}

.align-right-icon {
    --line-1: 100%;
    --line-2: 68%;
    --line-3: 86%;
    background-position:
        right 0 top 0,
        right 0 top 5px,
        right 0 bottom 0;
}

.align-justify-icon {
    --line-1: 100%;
    --line-2: 100%;
    --line-3: 100%;
}

.merge-code-button {
    width: 2.25rem;
    padding-inline: 0;
}

.barcode-icon,
.qr-icon,
.table-icon {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
}

.barcode-icon {
    background:
        linear-gradient(90deg,
            #0d3154 0 10%,
            transparent 10% 18%,
            #0d3154 18% 25%,
            transparent 25% 34%,
            #0d3154 34% 43%,
            transparent 43% 49%,
            #0d3154 49% 53%,
            transparent 53% 62%,
            #0d3154 62% 74%,
            transparent 74% 82%,
            #0d3154 82% 88%,
            transparent 88% 100%);
}

.qr-icon {
    border: 2px solid #0d3154;
    background:
        linear-gradient(#0d3154, #0d3154) 3px 3px / 4px 4px no-repeat,
        linear-gradient(#0d3154, #0d3154) calc(100% - 3px) 3px / 4px 4px no-repeat,
        linear-gradient(#0d3154, #0d3154) 3px calc(100% - 3px) / 4px 4px no-repeat,
        repeating-linear-gradient(90deg, transparent 0 3px, #0d3154 3px 5px);
}

.table-icon {
    border: 2px solid #0d3154;
    background:
        linear-gradient(#0d3154, #0d3154) 0 33% / 100% 1px no-repeat,
        linear-gradient(#0d3154, #0d3154) 0 66% / 100% 1px no-repeat,
        linear-gradient(#0d3154, #0d3154) 33% 0 / 1px 100% no-repeat,
        linear-gradient(#0d3154, #0d3154) 66% 0 / 1px 100% no-repeat;
}

.table-tool-button {
    padding-inline: 0.5rem;
}

.table-color-control {
    min-height: 1.95rem;
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #9ab1c3;
    border-radius: 4px;
    background: var(--selected-color, #fff2cc);
    color: var(--selected-color-text, #001a35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}

.table-color-button {
    min-height: 1.95rem;
    padding: 0 0.65rem;
    display: inline-grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 900;
}

.table-color-picker {
    position: relative;
    width: 1.75rem;
    min-width: 1.75rem;
    border-left: 1px solid rgba(13, 49, 84, .28);
    background:
        linear-gradient(45deg, rgba(255,255,255,.5) 25%, transparent 25% 50%, rgba(255,255,255,.5) 50% 75%, transparent 75%) 0 0 / 8px 8px,
        var(--selected-color, #fff2cc);
    cursor: pointer;
}

.table-color-picker input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.template-page-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    min-height: 1.95rem;
    padding: 0 0.35rem;
    border: 1px solid #9ab1c3;
    border-radius: 4px;
    background: #f4f8fb;
    color: #0d3154;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

.template-page-nav span {
    min-width: 5.8rem;
    text-align: center;
}

.template-page-nav .page-nav-button {
    width: 1.7rem;
    min-width: 1.7rem;
    min-height: 1.55rem;
    padding: 0;
    font-size: 0.72rem;
}

.template-page-nav .page-nav-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.template-merge-code {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
}

.template-edit-table {
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0.35rem 0;
    min-width: 120px;
}

.template-edit-table td,
.template-edit-table th {
    min-width: 44px;
    height: 1.6rem;
    padding: 0.25rem 0.35rem;
    border: 1px solid #526577;
    vertical-align: top;
}

.template-edit-table .template-table-cell-selected {
    outline: 2px solid #8f5fd7;
    outline-offset: -2px;
    background-color: rgba(205, 184, 255, 0.48) !important;
    box-shadow: inset 0 0 0 1px rgba(118, 74, 188, 0.22);
}

.image-input-button {
    position: relative;
    overflow: hidden;
    background: #5ab3e6;
    color: #001a35;
}

.image-input-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.template-body {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.template-fields {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    padding: 1.15rem 1.25rem;
    border-right: 1px solid #b8c8d6;
    background: #f7fafc;
}

.template-fields h2 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 900;
}

.template-fields p {
    margin: 0 0 0.7rem;
    color: #40515f;
    font-size: 0.78rem;
}

.template-fields-list {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    align-content: start;
    gap: 0.15rem;
}

.template-fields-list button {
    min-height: 1.8rem;
    padding: 0 0.25rem;
    border: 0;
    background: transparent;
    color: #001a35;
    text-align: left;
    font-size: 0.9rem;
}

.template-fields-list button:hover {
    background: #d9ecfb;
}

.template-document-zone {
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: auto;
    padding: 1.7rem 2rem;
    background: #d1d1d1;
}

.template-page-canvas {
    --paper-width: 210mm;
    --paper-height: 297mm;
    --ruler-size: 7mm;
    width: calc(var(--paper-width) + var(--ruler-size));
    min-height: calc(var(--paper-height) + var(--ruler-size));
    display: grid;
    grid-template-columns: var(--ruler-size) var(--paper-width);
    grid-template-rows: var(--ruler-size) var(--paper-height);
    margin: 0 auto;
}

.template-page-canvas.paper-letter {
    --paper-width: 216mm;
    --paper-height: 279mm;
}

.template-ruler-corner {
    grid-column: 1;
    grid-row: 1;
    background: #ffffff;
    border-right: 1px solid #a2a2a2;
    border-bottom: 1px solid #a2a2a2;
}

.template-ruler-horizontal,
.template-ruler-vertical {
    position: relative;
    overflow: visible;
    background-color: #ffffff;
}

.template-ruler-horizontal {
    grid-column: 2;
    grid-row: 1;
    height: var(--ruler-size);
    border-bottom: 1px solid #a2a2a2;
    background-image:
        repeating-linear-gradient(to right, #d5d5d5 0 1px, transparent 1px 1mm),
        repeating-linear-gradient(to right, transparent 0 4.8mm, #9a9a9a 4.8mm 5mm),
        repeating-linear-gradient(to right, transparent 0 9.7mm, #1f2937 9.7mm 10mm);
}

.template-ruler-horizontal span {
    position: absolute;
    top: 1.4mm;
    color: #111111;
    font-size: 0.62rem;
    line-height: 1;
    transform: translateX(-1mm);
}

.template-ruler-vertical {
    grid-column: 1;
    grid-row: 2;
    width: var(--ruler-size);
    height: var(--paper-height);
    border-right: 1px solid #a2a2a2;
    background-image:
        repeating-linear-gradient(to bottom, #d5d5d5 0 1px, transparent 1px 1mm),
        repeating-linear-gradient(to bottom, transparent 0 4.8mm, #9a9a9a 4.8mm 5mm),
        repeating-linear-gradient(to bottom, transparent 0 9.7mm, #1f2937 9.7mm 10mm);
}

.template-ruler-vertical span {
    position: absolute;
    left: 1.25mm;
    color: #111111;
    font-size: 0.62rem;
    line-height: 1;
    writing-mode: vertical-rl;
    transform: translateY(-1mm);
}

.template-margin-handle {
    position: absolute;
    z-index: 4;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 1px solid #062d55;
    background: #0f4e85;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .32);
}

.template-margin-handle.horizontal {
    bottom: -1px;
    transform: translateX(-50%);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    cursor: ew-resize;
}

.template-margin-handle.vertical {
    right: -1px;
    transform: translateY(-50%);
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    cursor: ns-resize;
}

.template-margin-handle:hover,
.template-margin-handle:focus-visible {
    background: #0a63a9;
    border-color: #001f3d;
    outline: 2px solid rgba(15, 78, 133, .28);
    outline-offset: 2px;
}

body.template-margin-dragging {
    cursor: grabbing;
    user-select: none;
}

.involved-form-surface {
    display: grid;
    gap: 0.75rem;
}

.template-paper,
.template-preview-paper {
    background: #ffffff;
    color: #17212b;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

.template-paper {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    width: var(--paper-width);
    height: var(--paper-height);
    min-height: var(--paper-height);
    box-sizing: border-box;
    display: grid;
    grid-template-rows: minmax(var(--header-height, 24mm), auto) minmax(0, 1fr) minmax(var(--footer-height, 18mm), auto);
    gap: 4mm;
    overflow: hidden;
}

.template-paper-extra {
    grid-column: 2;
    grid-row: auto;
    position: relative;
    width: var(--paper-width);
    height: var(--paper-height);
    min-height: var(--paper-height);
    margin-top: 10mm;
}

.template-paper-extra .template-repeated-region {
    pointer-events: none;
    user-select: none;
}

.template-margin-box {
    position: absolute;
    z-index: 1;
    inset: var(--margin-top, 20mm) var(--margin-right, 20mm) var(--margin-bottom, 20mm) var(--margin-left, 20mm);
    border: 1px dashed rgba(10, 78, 139, .72);
    box-shadow: inset 0 0 0 1px rgba(10, 78, 139, .16);
    pointer-events: none;
}

.template-paper > .template-editor-region {
    position: relative;
    z-index: 2;
    min-height: 0;
}

.template-preview-paper.paper-a4,
.paper-a4:not(.template-page-canvas) {
    width: 210mm;
    min-height: 297mm;
}

.template-preview-paper.paper-letter,
.paper-letter:not(.template-page-canvas) {
    width: 216mm;
    min-height: 279mm;
}

.template-editor {
    outline: none;
    color: #17212b;
    font-size: 11pt;
}

.template-editor-region {
    outline: none;
    color: #17212b;
    font-size: 11pt;
}

.template-header-editor,
.template-footer-editor {
    border: 1px dashed #c6d2dc;
    color: #526577;
}

.template-header-editor {
    min-height: var(--header-height, 24mm);
}

.template-footer-editor {
    min-height: var(--footer-height, 18mm);
}

.template-editor {
    min-height: 0;
    overflow: hidden;
}

.template-editor-region:focus {
    outline: 2px solid rgba(29, 95, 153, 0.22);
    outline-offset: 2px;
}

.template-editor-region img.template-resizable-image {
    max-width: 100%;
    height: auto;
}

.template-editor-region img.template-image-selected {
    outline: 2px solid #1d5f99;
    outline-offset: 3px;
}

.template-editor-region img.template-image-selected::selection {
    background: transparent;
}

.template-header-editor:empty::before {
    content: "Cabecera";
    color: #8a9bb2;
}

.template-editor:empty::before {
    content: "Diseñe aquí la plantilla del documento";
    color: #8a9bb2;
}

.template-footer-editor:empty::before {
    content: "Pie";
    color: #8a9bb2;
}

.template-preview-paper {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: minmax(var(--header-height, 24mm), auto) minmax(0, 1fr) minmax(var(--footer-height, 18mm), auto);
    gap: 4mm;
}

.template-preview-header,
.template-preview-body,
.template-preview-footer {
    color: #17212b;
    font-size: 11pt;
}

.template-preview-header,
.template-preview-footer {
    color: #526577;
}

.template-preview-dialog {
    width: min(980px, 96vw);
    max-height: 92vh;
    overflow: auto;
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #b9c7d3;
    border-radius: 6px;
    background: #e5eef7;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.template-preview-dialog header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.template-preview-dialog h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
}

.template-open-dialog {
    width: min(760px, 94vw);
    max-height: 86vh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #b9c7d3;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.template-open-dialog header,
.template-open-dialog footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
}

.template-open-dialog header h2 {
    margin: 0 auto 0 0;
    font-size: 1.15rem;
    font-weight: 900;
}

.template-open-grid {
    min-width: 100%;
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    .complaint-form-grid {
        grid-template-columns: 1fr;
    }

    .complaint-form-grid label.wide {
        grid-column: auto;
    }
}


}

.pm-plantillas {
 position:fixed;inset:12px;z-index:1300;display:flex;min-width:0;overflow:hidden;
 border:1px solid #b4cbdd;border-radius:6px;background:#fff;box-shadow:0 14px 40px #102d4740;
 color:#183c59;font:13px 'Segoe UI',Arial,sans-serif;
 .templates-page{height:100%;width:100%;margin:0;display:flex;flex-direction:column;min-height:0;background:#fff;font:inherit}
 .templates-titlebar{flex:none;min-height:58px;padding:12px 18px;background:#d9edf7;border-bottom:1px solid #afcbdc}
 .templates-title{gap:10px}.templates-title h1{margin:0;color:#073e70;font:700 21px/1.25 'Segoe UI',Arial,sans-serif}
 .pm-icono{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;flex:0 0 22px;background:transparent;border:0;border-radius:0;box-shadow:none;color:inherit}
 .pm-icono svg{width:22px;height:22px}.templates-title .pm-icono{width:26px;height:26px;flex-basis:26px}.templates-title .pm-icono svg{width:26px;height:26px}
 .templates-actions{display:flex;align-items:center;flex-wrap:wrap;justify-content:flex-start;gap:6px;padding:8px 18px;background:#f0f5f9;border-bottom:1px solid #d4e1eb;flex:none}
 .templates-actions .template-action{display:inline-flex;align-items:center;justify-content:center;gap:0;width:36px;min-width:36px;height:34px;min-height:34px;padding:5px 6px;border:1px solid #bad0e1;border-radius:4px;background:#eaf2f8;background-image:none;box-shadow:none;color:#214d70;font:13px 'Segoe UI',Arial,sans-serif;cursor:pointer}
 .templates-actions .template-action>span:not(.pm-icono){display:none}
 .templates-actions .template-action:hover:not(:disabled){background:#d9eaf6!important;color:#214d70}
 .templates-actions button:focus-visible,.format-button:focus-visible,.template-fields-list button:focus-visible{outline:2px solid #1475b8;outline-offset:2px}
 .templates-actions button:disabled{opacity:.45;cursor:default}
 .templates-actions .auxiliares-rejilla-herramienta{margin:0}.templates-actions .auxiliares-rejilla-boton{min-height:34px;margin:0}
 .template-message{padding:7px 18px;font-weight:400;font-size:13px}
 .template-editor-shell{flex:1;min-height:0;overflow:hidden}.template-workspace{height:100%;grid-template-rows:auto auto minmax(0,1fr)}
 .template-meta{grid-template-columns:minmax(200px,1fr) minmax(280px,2fr);padding:10px 18px;gap:18px;background:#fff}
 .template-meta label{display:grid;grid-template-columns:1fr;gap:5px;font:600 12px 'Segoe UI',Arial,sans-serif}
 .template-meta input,.template-meta select{height:34px;min-height:34px;border-radius:4px;padding:6px 9px;font:13px 'Segoe UI',Arial,sans-serif;color:#183c59}
 .template-formatbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;padding:8px 18px;background:#f0f5f9;border-bottom:1px solid #d4e1eb;overflow:visible;max-height:none}
 .template-format-group{display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;min-width:0;padding:2px 10px 2px 0;border-right:1px solid #cadce9}
 .template-formatbar label{display:inline-flex;align-items:center;gap:4px;margin:0;font:400 12px 'Segoe UI',Arial,sans-serif}
 .template-formatbar input,.template-formatbar select{height:30px;min-height:30px;border-radius:3px;padding:3px 6px;font:13px 'Segoe UI',Arial,sans-serif;color:#183c59}
 .template-formatbar .compact-number{width:54px}.template-formatbar .compact-select{width:105px}.template-formatbar .paper-size-select{width:124px}
 .format-button,.image-input-button{height:30px;min-height:30px;padding:3px 7px;border:1px solid #bad0e1;border-radius:3px;background:#eaf2f8;color:#214d70;font:13px 'Segoe UI',Arial,sans-serif;box-shadow:none;display:inline-flex;align-items:center;justify-content:center}
 .format-button:hover,.image-input-button:hover{background:#d9eaf6}.format-button.strong{font-weight:700}.format-button.italic{font-style:italic}.format-button.underline{text-decoration:underline}
 .format-button .pm-icono,.format-button .pm-icono svg{width:18px;height:18px;flex-basis:18px}
 .template-page-nav{margin:0;gap:4px;white-space:nowrap}.template-page-nav span{font-size:12px;font-weight:400}
 .template-body{grid-template-columns:230px minmax(0,1fr)}.template-fields{padding:14px 12px;overflow:hidden;background:#f7fafc}
 .template-fields h2{font:700 14px 'Segoe UI',Arial,sans-serif}.template-fields p{font-size:12px;line-height:1.5}
 .template-fields-list{overflow:auto;gap:2px}.template-fields-list button{padding:6px 8px;min-height:30px;border-radius:3px;font:13px 'Segoe UI',Arial,sans-serif;overflow-wrap:anywhere}
 .template-document-zone{padding:20px;background:#e4eaf0;scrollbar-gutter:stable}
 .template-page-canvas{zoom:1.25;margin:0 auto}.template-paper{zoom:1;box-shadow:0 3px 14px #19354f26}
 .grid-config-overlay{position:fixed;inset:0;z-index:1310;background:#102b4b77;display:grid;place-items:center;padding:15px;overflow:auto}
 .app-message-dialog,.template-open-dialog,.template-preview-dialog{background:white;border:1px solid #aac0d2;border-radius:6px;box-shadow:0 8px 24px #1235;padding:20px;max-width:96vw;max-height:92dvh;overflow:auto}
 .app-message-dialog{width:540px}.app-message-dialog h2{font-size:1.25rem}.app-message-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
 .template-open-dialog{width:1000px}.template-preview-dialog{width:1100px}.template-preview-dialog>header,.template-open-dialog>header{display:flex;gap:8px;align-items:center;justify-content:space-between;margin-bottom:14px}
 .template-preview-dialog h2,.template-open-dialog h2{font-size:1.3rem}.data-grid{width:100%;border-collapse:collapse}.data-grid td,.data-grid th{border:1px solid #bfd0df;padding:8px}.data-grid th{background:#e8f1fa}
}
@media(max-width:800px){.pm-plantillas{inset:0;border-radius:0;
 .templates-titlebar{min-height:50px;padding:10px 12px}.templates-title h1{font-size:18px}.templates-title .pm-icono{display:none}
 .templates-actions{padding:7px 10px;gap:4px}.templates-actions .template-action{width:34px;min-width:34px}
 .template-meta{grid-template-columns:1fr;padding:8px 12px;gap:8px}.template-meta label{grid-template-columns:100px minmax(0,1fr);align-items:center}
 .template-formatbar{padding:6px 10px;max-height:150px;overflow:auto;gap:6px}.template-format-group{border-right:0;padding:0;gap:4px}
 .template-body{grid-template-columns:145px minmax(0,1fr)}.template-fields{padding:10px 6px}.template-fields-list button{padding:6px 4px}
 .template-document-zone{padding:12px}.template-page-canvas{zoom:.75}.template-paper{zoom:1}
}}

