/* MESSAGE TEMPLATES */
.template-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.template-toolbar { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); }
.template-search { flex: 1; }
.template-search input, .template-toolbar select, .template-field input, .template-field select, .template-field textarea { width: 100%; box-sizing: border-box; color: var(--text-primary); background: var(--bg-main); border: 1px solid var(--border); border-radius: 9px; font: inherit; outline: none; }
.template-search input, .template-toolbar select, .template-field input, .template-field select { min-height: 44px; padding: 0 13px; }
.template-search input:focus, .template-toolbar select:focus, .template-field input:focus, .template-field select:focus, .template-field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30, 94, 255, .14); }
.template-toolbar select { width: 180px; }
.template-primary-button, .template-secondary-button { min-height: 44px; padding: 0 16px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.template-primary-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.template-primary-button:hover { filter: brightness(1.12); }
.template-secondary-button { border: 1px solid var(--border); color: var(--text-primary); background: transparent; }
.template-summary { margin: 20px 0 14px; color: var(--text-secondary); font-size: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.template-card { display: flex; min-height: 212px; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); }
.template-card-header, .template-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.template-card-title { overflow: hidden; margin: 0; color: var(--text-primary); font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.template-channel { flex: none; padding: 4px 9px; border-radius: 99px; color: #82adff; background: rgba(30, 94, 255, .15); font-size: 12px; font-weight: 600; }
.template-content { display: -webkit-box; flex: 1; margin: 16px 0; overflow: hidden; color: var(--text-secondary); font-size: 14px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.template-updated { color: var(--text-muted); font-size: 12px; }
.template-actions { display: flex; gap: 8px; }
.template-action { border: 0; padding: 5px 0; color: var(--blue-light); background: transparent; cursor: pointer; font: inherit; font-size: 13px; }
.template-action.delete { color: #ff7272; }
.template-empty { padding: 54px 20px; border: 1px dashed var(--border); border-radius: 14px; color: var(--text-secondary); text-align: center; }
.hidden { display: none !important; }
.template-modal { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3, 10, 23, .72); }
.template-modal-box { width: min(570px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .38); }
.template-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.template-modal-header h3 { margin: 0; color: var(--text-primary); font-size: 19px; }
.template-modal-header button { border: 0; color: var(--text-secondary); background: transparent; cursor: pointer; font-size: 28px; line-height: 1; }
.template-form { padding: 20px; }
.template-field { margin-bottom: 18px; }
.template-field label { display: block; margin-bottom: 8px; color: var(--text-primary); font-size: 14px; font-weight: 600; }
.template-field textarea { min-height: 168px; padding: 12px 13px; resize: vertical; line-height: 1.55; }
.template-character-count { margin-top: 6px; color: var(--text-muted); text-align: right; font-size: 12px; }
.template-form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.template-toast { position: fixed; z-index: 3000; top: 24px; right: 24px; max-width: calc(100vw - 48px); padding: 13px 17px; border: 1px solid rgba(53, 208, 127, .35); border-radius: 10px; color: #fff; background: #102f2b; box-shadow: 0 12px 30px rgba(0, 0, 0, .28); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 1100px) { .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) { .template-heading, .template-toolbar { flex-direction: column; } .template-heading .template-primary-button, .template-toolbar select { width: 100%; } .template-grid { grid-template-columns: 1fr; } .template-form-actions .template-primary-button, .template-form-actions .template-secondary-button { flex: 1; } }
