:root {
    --portal-bg-top: #c82222;
    --portal-bg-bottom: #0f6782;
    --portal-card: rgba(253, 248, 251, 0.94);
    --portal-border: rgba(127, 202, 225, 0.45);
    --portal-primary: #1089aa;
    --portal-primary-dark: #0b6d88;
    --portal-ink: #0d3550;
    --portal-muted: #5f8796;
    --portal-danger: #bf3952;
    --portal-success: #1ab188;
    --portal-shadow-soft: 0 16px 36px rgba(8, 74, 95, 0.12);
    --portal-shadow-card: 0 22px 40px rgba(6, 64, 84, 0.14);
    --editor-surface: #f8fcff;
    --editor-surface-soft: #f1f8fc;
    --editor-border: rgba(126, 191, 214, 0.38);
    --editor-border-strong: rgba(101, 174, 201, 0.54);
    --editor-text-strong: #17445f;
    --editor-text-muted: #527988;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 137, 170, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(16, 137, 170, 0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes backgroundFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes sectionHighlight {
    0% {
        background-color: rgba(26, 177, 136, 0.2);
        box-shadow: 0 0 0 0 rgba(26, 177, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(26, 177, 136, 0);
    }
    100% {
        background-color: transparent;
        box-shadow: 0 0 0 0 rgba(26, 177, 136, 0);
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    min-height: 100%;
}

body {
    color: var(--portal-ink);
    background: #f3eef2;
}

body.login-shell {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.02) 35%, transparent 35%) 0 0 / 140px 140px,
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #25a9cc 0%, #1a8fb2 38%, #0f6b89 100%);
}

body.dashboard-shell {
    background:
    radial-gradient(circle at top right, rgba(28, 132, 163, 0.1), transparent 40%),
    linear-gradient(180deg, #f6fafc 0%, #edf4f8 100%);
}

.portal-shell {
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    line-height: 1.4;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
}

.dashboard-page {
    padding: 24px;
    position: relative;
    display: block;
}

.login-page::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(34, 166, 200, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: backgroundFloat 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.login-page::after {
    content: '';
    position: fixed;
    bottom: -20%;
    left: -5%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(15, 103, 130, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: backgroundFloat 10s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
}

.login-card,
.dashboard-panel {
    width: min(100%, 440px);
    background: var(--portal-card);
    border: 1px solid rgba(255, 255, 255, 0.36);
    box-shadow: 0 28px 70px rgba(6, 64, 84, 0.28);
    position: relative;
    z-index: 10;
}

.login-card {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.login-card {
    border-radius: 24px;
    padding: 32px 28px;
    animation: fadeInScale 0.6s ease-out, glow 2s ease-in-out infinite;
}

.dashboard-panel {
    width: min(100%, 1320px);
    margin: 0 auto;
    border-radius: 28px;
    padding: 14px;
    border: 1px solid rgba(184, 215, 229, 0.95);
    box-shadow: 0 14px 28px rgba(7, 68, 89, 0.12);
    background: rgba(253, 255, 255, 0.98);
}

.dashboard-panel-wide {
    width: min(100%, 1320px);
}

.brand-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 22px;
    text-align: left;
    animation: slideInUp 0.7s ease-out 0.1s both;
}

.brand-mark {
    position: relative;
    width: 54px;
    height: 54px;
}

.brand-logo {
    width: 280px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 7px 16px rgba(15, 103, 130, 0.16));
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 12px 24px rgba(15, 103, 130, 0.28));
}

.brand-logo-wrap {
    width: auto;
    height: auto;
    overflow: visible;
}

.brand-mark span {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 4px solid #2ca6c0;
    border-radius: 50%;
}

.brand-mark span:nth-child(1) { top: 0; left: 15px; }
.brand-mark span:nth-child(2) { top: 15px; right: 0; }
.brand-mark span:nth-child(3) { bottom: 0; left: 15px; }
.brand-mark span:nth-child(4) { top: 15px; left: 0; }

.brand-name {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
}

.brand-subtitle,
.brand-caption {
    margin: 2px 0 0;
    color: var(--portal-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.72rem;
}

.brand-caption {
    letter-spacing: 0.12em;
    font-size: 0.65rem;
}

.login-header {
    margin-bottom: 28px;
    text-align: center;
    animation: slideInUp 0.7s ease-out 0.2s both;
}

.login-header h1,
.dashboard-topbar h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 800;
}

.login-header p,
.muted,
.login-footer,
.login-meta,
.card-label,
.info-card span,
.eyebrow {
    color: var(--portal-muted);
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-form {
    display: grid;
    gap: 18px;
    animation: slideInUp 0.7s ease-out 0.3s both;
}

.field-group {
    display: grid;
    gap: 8px;
    opacity: 0;
    animation: slideInUp 0.6s ease-out forwards;
}

.field-group:nth-child(1) { animation-delay: 0.4s; }
.field-group:nth-child(2) { animation-delay: 0.5s; }

.field-group label {
    font-size: 0.83rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--portal-primary);
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    padding: 0 14px;
    min-height: 54px;
    transition: all 0.3s ease;
    position: relative;
}

.input-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.input-wrap:focus-within {
    border-color: rgba(16, 137, 170, 0.7);
    box-shadow: 0 0 0 4px rgba(16, 137, 170, 0.12);
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-2px);
}

.input-wrap.valid {
    border-color: var(--portal-success);
    box-shadow: 0 0 0 4px rgba(26, 177, 136, 0.12);
}

.input-wrap input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--portal-ink);
    font-size: 0.97rem;
}

.field-icon,
.password-toggle {
    color: #26a9d0;
    font-weight: 800;
}

.field-icon {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.password-toggle {
    border: 1px solid rgba(38, 169, 208, 0.25);
    background: rgba(38, 169, 208, 0.08);
    cursor: pointer;
    padding: 2px 8px;
    min-width: 54px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.password-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.password-toggle:hover {
    background: rgba(38, 169, 208, 0.14);
    border-color: rgba(38, 169, 208, 0.42);
    transform: scale(1.02);
}

.password-toggle:hover::before {
    transform: translateX(100%);
}

.password-toggle:active {
    transform: scale(0.98);
}

.field-error,
.alert-box {
    margin: 0;
    color: var(--portal-danger);
    font-size: 0.88rem;
}

.alert-box {
    border: 1px solid rgba(191, 57, 82, 0.18);
    background: rgba(191, 57, 82, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    animation: slideInUp 0.5s ease-out;
}

.alert-box.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.field-error {
    animation: slideRight 0.3s ease-out;
}

.login-meta,
.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.dashboard-topbar {
    padding: 18px 18px 20px;
    border-radius: 20px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(244, 251, 255, 0.96));
    border: 1px solid rgba(154, 209, 229, 0.45);
}

.login-meta {
    font-size: 0.88rem;
    justify-content: flex-end;
}

.login-meta a {
    color: var(--portal-primary);
    text-decoration: none;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 14px;
    min-height: 54px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-button {
    color: white;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-primary-dark));
    box-shadow: 0 18px 28px rgba(16, 137, 170, 0.26);
    position: relative;
    overflow: hidden;
    width: 100%;
    animation: slideInUp 0.7s ease-out 0.6s both;
}

.primary-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 24px 36px rgba(16, 137, 170, 0.36);
}

.primary-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 12px 20px rgba(16, 137, 170, 0.2);
}

.primary-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.secondary-button {
    padding: 0 18px;
    color: var(--portal-primary-dark);
    background: rgba(16, 137, 170, 0.1);
}

/* Loading State */
.login-form.loading {
    pointer-events: none;
}

.primary-button.loading {
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-primary-dark));
    color: transparent;
}

.primary-button.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Validation Indicators */
.field-indicator {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.field-indicator.show {
    opacity: 1;
    animation: slideRight 0.3s ease-out;
}

.field-indicator.valid {
    color: var(--portal-success);
}

.field-indicator.invalid {
    color: var(--portal-danger);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.84rem;
}

.login-footer p {
    margin: 4px 0;
}

.dashboard-grid {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-grid-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.admin-list-card,
.admin-editor-card {
    align-self: start;
}

.admin-list-card {
    margin-top: 18px;
}

.admin-editor-card {
    min-width: 0;
    overflow: hidden;
}

/* ============================================================
   MODAL EDITOR
   ============================================================ */

.editor-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 30, 44, 0.46);
    display: grid;
    place-items: center;
    z-index: 1000;
    padding: 24px 16px;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.18s ease-out;
}

.editor-modal-overlay[hidden] {
    display: none;
}

.editor-modal-dialog {
    width: min(1280px, 100%);
    max-height: calc(100vh - 48px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: var(--editor-surface);
    border: 1px solid var(--editor-border-strong);
    box-shadow: 0 28px 68px rgba(8, 57, 77, 0.28);
    animation: slideInUp 0.22s ease-out;
    overflow: hidden;
}

.editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(127, 202, 225, 0.3);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 251, 255, 0.88));
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-save-status {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--portal-muted);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(127, 202, 225, 0.28);
    background: rgba(248, 251, 253, 0.85);
}

.editor-save-status.is-dirty {
    color: #b8860b;
    border-color: rgba(250, 200, 100, 0.45);
    background: rgba(250, 200, 100, 0.14);
}

.editor-save-status.is-saving {
    color: var(--portal-primary);
    border-color: rgba(16, 137, 170, 0.42);
    background: rgba(16, 137, 170, 0.12);
}

.editor-save-status.is-saved {
    color: #138a68;
    border-color: rgba(19, 138, 104, 0.36);
    background: rgba(19, 138, 104, 0.12);
}

.editor-modal-header .card-label {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--editor-text-strong);
}

.editor-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(127, 202, 225, 0.4);
    background: transparent;
    color: var(--portal-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.editor-modal-close:hover {
    background: rgba(191, 57, 82, 0.1);
    border-color: rgba(191, 57, 82, 0.4);
    color: #bf3952;
    transform: scale(1.08);
}

.editor-modal-close:focus-visible {
    outline: 2px solid var(--portal-primary);
    outline-offset: 2px;
}

.editor-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 22px 26px;
    overscroll-behavior: contain;
}

.editor-modal-body::-webkit-scrollbar {
    width: 8px;
}

.editor-modal-body::-webkit-scrollbar-thumb {
    background: rgba(14, 112, 140, 0.38);
    border-radius: 999px;
    border: 2px solid #f7fcfe;
}

.editor-modal-body::-webkit-scrollbar-track {
    background: rgba(210, 235, 244, 0.4);
    border-radius: 999px;
}

.info-card {
    display: grid;
    gap: 8px;
    padding: 22px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(127, 202, 225, 0.35);
    box-shadow: var(--portal-shadow-soft);
}

.info-card strong {
    font-size: 1.1rem;
}

.summary-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.summary-card .card-label {
    margin: 0;
    font-size: 1.03rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--portal-primary);
    line-height: 1.2;
}

.summary-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    border-radius: 20px 0 0 20px;
    background: rgba(16, 137, 170, 0.22);
}

.summary-card[data-summary-filter] {
    cursor: pointer;
}

.summary-card[data-summary-filter]:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow-card);
}

.summary-card.is-active {
    border-color: rgba(16, 137, 170, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 137, 170, 0.12), var(--portal-shadow-card);
}

.summary-card-groups::before {
    background: rgba(16, 137, 170, 0.45);
}

.summary-card-configured::before {
    background: rgba(60, 130, 246, 0.42);
}

.summary-card-active::before {
    background: rgba(26, 177, 136, 0.52);
}

.summary-card-inactive::before {
    background: rgba(191, 57, 82, 0.52);
}

.summary-card-pending::before {
    background: rgba(222, 173, 39, 0.58);
}

.summary-help {
    margin: 10px 2px 0;
    color: var(--portal-muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.info-card-wide {
    grid-column: 1 / -1;
}

/* Editor Header */
.editor-header {
    padding-bottom: 8px;
    margin-bottom: 0;
}

.editor-header-content {
    display: grid;
    gap: 12px;
}

.editor-empty-state {
    font-size: 0.9rem;
    color: var(--portal-muted);
    line-height: 1.5;
}

/* Editor Tab Navigation */
.editor-tab-nav {
    display: flex;
    gap: 4px;
    padding: 6px 6px 0;
    margin: 8px 0 4px;
    border-bottom: 1px solid var(--editor-border-strong);
    background: linear-gradient(180deg, rgba(242, 249, 253, 0.75), rgba(242, 249, 253, 0));
}

.editor-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--editor-text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    position: relative;
    bottom: -2px;
}

.editor-tab-btn:hover {
    background: rgba(16, 137, 170, 0.1);
    color: var(--editor-text-strong);
}

.editor-tab-btn:focus-visible {
    outline: 2px solid var(--portal-primary);
    outline-offset: -2px;
    border-radius: 10px 10px 0 0;
}

.editor-tab-btn.is-active {
    background: #ffffff;
    color: var(--editor-text-strong);
    border-color: var(--editor-border-strong);
    border-bottom-color: #ffffff;
    font-weight: 800;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.9), 0 2px 8px rgba(8, 73, 97, 0.08);
}

/* Tab Panel Visibility */
[data-tab-panel].tab-hidden {
    display: none !important;
}

.editor-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1187aa 0%, #0d6f90 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 118, 150, 0.3);
}

.editor-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 118, 150, 0.4);
}

.editor-save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 118, 150, 0.3);
}

.editor-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.editor-save-btn.is-loading {
    opacity: 0.82;
    cursor: progress;
    box-shadow: 0 2px 8px rgba(16, 118, 150, 0.22);
}

/* Hide old final-section submit button */
.form-section-final .form-actions-final {
    display: none !important;
}

.admin-list-card {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(127, 202, 225, 0.25);
}

.table-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.6fr) minmax(120px, 0.35fr);
    gap: 12px;
    margin-top: 12px;
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 10px;
    border-radius: 14px;
    background: rgba(247, 252, 255, 0.98);
    border: 1px solid rgba(151, 205, 226, 0.4);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.toolbar-field {
    opacity: 1;
    animation: none;
}

.toolbar-search {
    min-width: 0;
}

.toolbar-select {
    min-width: 0;
}

.input-wrap select {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--portal-ink);
    font-size: 0.95rem;
    outline: none;
}

.table-meta {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--portal-muted);
    font-size: 0.9rem;
}

.table-reset-button,
.table-page-button {
    min-height: 42px;
    font-size: 0.9rem;
}

.selected-group-summary {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(127, 202, 225, 0.35);
    background: rgba(16, 137, 170, 0.08);
    min-width: 0;
}

.selected-group-summary strong,
.selected-group-summary span {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.summary-updated-at {
    font-size: 0.82rem;
    color: var(--portal-muted);
}

.dashboard-table-wrap {
    max-height: none;
    overflow: visible;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(232, 246, 251, 0.72), rgba(247, 252, 254, 0.82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.dashboard-table {
    min-width: 1040px;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    color: #18445d;
}

.dashboard-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: normal;
    line-height: 1.2;
    vertical-align: top;
    color: #0f4a67;
    background: linear-gradient(180deg, #e5f5fb 0%, #d6edf6 100%);
    background-clip: padding-box;
    border-bottom: 1px solid rgba(127, 202, 225, 0.5);
    box-shadow: inset 0 -1px 0 rgba(127, 202, 225, 0.22);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dashboard-table th:first-child {
    border-top-left-radius: 12px;
}

.dashboard-table th:last-child {
    border-top-right-radius: 12px;
}

.dashboard-table td {
    padding-top: 12px;
    padding-bottom: 12px;
    background: rgba(255, 255, 255, 0.84);
    border-bottom: 1px solid rgba(127, 202, 225, 0.34);
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
}

.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1) {
    width: 12%;
}

.dashboard-table th:nth-child(2),
.dashboard-table td:nth-child(2) {
    width: 24%;
}

.dashboard-table th:nth-child(3),
.dashboard-table td:nth-child(3) {
    width: 14%;
}

.dashboard-table th:nth-child(4),
.dashboard-table td:nth-child(4) {
    width: 15%;
}

.dashboard-table th:nth-child(5),
.dashboard-table td:nth-child(5) {
    width: 11%;
}

.dashboard-table th:nth-child(6),
.dashboard-table td:nth-child(6) {
    width: 14%;
}

.dashboard-table th:nth-child(7),
.dashboard-table td:nth-child(7) {
    width: 10%;
}

.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1),
.dashboard-table th:nth-child(7),
.dashboard-table td:nth-child(7) {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.dashboard-table td:nth-child(1) {
    text-align: left;
}

.dashboard-table td:nth-child(7) {
    overflow: hidden;
}

.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1),
.dashboard-table th:nth-child(7),
.dashboard-table td:nth-child(7) {
    padding-left: 8px;
    padding-right: 8px;
}

.dashboard-table tbody tr {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dashboard-table tbody tr[hidden] {
    display: none !important;
}

.dashboard-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.9);
}

.dashboard-table tbody tr:nth-child(even):not(.is-selected-row) td {
    background: rgba(246, 252, 255, 0.82);
}

.dashboard-table tbody tr:focus-visible {
    outline: 2px solid rgba(16, 137, 170, 0.45);
    outline-offset: -2px;
}

.table-subtext {
    margin-top: 4px;
    color: var(--portal-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-badge.is-active {
    color: #0f6f58;
    border-color: rgba(26, 177, 136, 0.28);
    background: rgba(26, 177, 136, 0.16);
}

.status-badge.is-inactive {
    color: #8a1230;
    border-color: rgba(191, 57, 82, 0.28);
    background: rgba(191, 57, 82, 0.16);
}

.status-badge.is-pending {
    color: #8a6708;
    border-color: rgba(222, 173, 39, 0.3);
    background: rgba(222, 173, 39, 0.2);
}

.table-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--portal-primary-dark);
    font-weight: 800;
    text-decoration: none;
    border: 1px solid rgba(16, 137, 170, 0.26);
    border-radius: 7px;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    transition: all 0.2s ease;
}

.table-action-link:hover {
    text-decoration: none;
    border-color: rgba(8, 105, 133, 0.42);
    background: rgba(227, 246, 252, 0.55);
    transform: translateY(-1px);
}

.table-action-link.is-editing {
    color: #0f7a95;
    border-color: rgba(16, 137, 170, 0.62);
    background: rgba(24, 162, 197, 0.13);
}

.table-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.table-action-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.05;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Table Actions Cell */
.table-actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toggle Status Button */
.toggle-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 6px;
    border: 2px solid;
    background: white;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.toggle-status-btn.is-active {
    border-color: var(--portal-success);
    color: var(--portal-success);
}

.toggle-status-btn.is-active:hover {
    background: rgba(26, 177, 136, 0.1);
    box-shadow: 0 4px 12px rgba(26, 177, 136, 0.2);
    transform: translateY(-1px);
}

.toggle-status-btn.is-inactive {
    border-color: var(--portal-danger);
    color: var(--portal-danger);
    opacity: 0.7;
}

.toggle-status-btn.is-inactive:hover {
    background: rgba(191, 57, 82, 0.1);
    box-shadow: 0 4px 12px rgba(191, 57, 82, 0.2);
    transform: translateY(-1px);
    opacity: 1;
}

.toggle-status-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.toggle-status-btn.loading {
    animation: spin 1s linear infinite;
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.is-selected-row {
    background: transparent;
}

.is-selected-row td {
    background: rgba(225, 245, 252, 0.95);
    border-bottom-color: rgba(73, 173, 203, 0.28);
}

.secondary-button:focus-visible,
.primary-button:focus-visible,
.table-action-link:focus-visible,
.summary-card[data-summary-filter]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(16, 137, 170, 0.3);
    outline-offset: 2px;
}

.table-empty-state {
    margin-top: 12px;
    padding: 16px;
    border: 1px dashed rgba(127, 202, 225, 0.5);
    border-radius: 12px;
    color: var(--portal-muted);
    text-align: center;
}

.table-pagination {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.table-page-label {
    min-width: 110px;
    text-align: center;
    color: var(--portal-muted);
    font-size: 0.9rem;
}

.metadata-note {
    margin: 8px 0 0;
}

.alert-success {
    color: #0f6f58;
    border-color: rgba(26, 177, 136, 0.35);
    background: rgba(26, 177, 136, 0.12);
}

.stack-form {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.split-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.inline-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--portal-ink);
    font-size: 0.9rem;
}

.groups-list {
    display: grid;
    gap: 10px;
    margin-top: 8px;
    max-height: 280px;
    overflow: auto;
    padding-right: 6px;
}

.bulk-groups-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 260px;
    overflow: auto;
    padding-right: 6px;
}

.bulk-group-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(127, 202, 225, 0.32);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.74);
    padding: 10px 12px;
}

.bulk-group-item input {
    width: 16px;
    height: 16px;
}

.bulk-group-item span {
    font-size: 0.9rem;
}

.group-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--portal-ink);
    border: 1px solid rgba(127, 202, 225, 0.35);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.group-pill:hover {
    border-color: rgba(16, 137, 170, 0.55);
    transform: translateY(-1px);
}

.group-pill.is-selected {
    border-color: rgba(16, 137, 170, 0.75);
    background: rgba(16, 137, 170, 0.14);
}

textarea {
    width: 100%;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--portal-ink);
    background: rgba(255, 255, 255, 0.78);
    resize: vertical;
    min-height: 96px;
}

textarea:focus {
    outline: none;
    border-color: rgba(16, 137, 170, 0.7);
    box-shadow: 0 0 0 4px rgba(16, 137, 170, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.form-actions-final {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(26, 177, 136, 0.2);
}

.button-lg {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    box-shadow: 0 4px 12px rgba(16, 137, 170, 0.25);
}

.button-lg:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(16, 137, 170, 0.35);
    transform: translateY(-2px);
}

/* Status Configuration Section */
.status-configuration {
    padding: 16px;
    background: rgba(248, 251, 253, 0.64);
    border-radius: 12px;
    border: 1px solid rgba(86, 180, 210, 0.26);
    display: grid;
    gap: 12px;
}

.status-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
}

.status-checkbox-wrap:hover {
    opacity: 0.9;
}

.checkbox-control {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.status-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    cursor: pointer;
}

.checkbox-mark {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border: 2px solid var(--portal-primary);
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.status-checkbox:checked + .checkbox-mark {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
}

.status-checkbox:checked + .checkbox-mark::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-checkbox:focus-visible + .checkbox-mark {
    outline: 2px solid var(--portal-primary);
    outline-offset: 2px;
}

.checkbox-label-group {
    display: grid;
    gap: 4px;
    flex: 1;
}

.checkbox-label-main {
    font-weight: 600;
    color: var(--portal-ink);
    font-size: 0.95rem;
}

.checkbox-label-hint {
    font-size: 0.8rem;
    color: var(--portal-muted);
    line-height: 1.4;
}

.inline-delete-form {
    margin-top: 10px;
}

.danger-button {
    color: #8a1230;
    background: rgba(191, 57, 82, 0.12);
}

.danger-button:hover {
    background: rgba(191, 57, 82, 0.2);
}

.mini-table-wrap {
    margin-top: 14px;
    border: 1px solid rgba(127, 202, 225, 0.3);
    border-radius: 12px;
    overflow: auto;
}

.mini-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.mini-table th,
.mini-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(127, 202, 225, 0.25);
    text-align: left;
}

.mini-table thead {
    background: rgba(16, 137, 170, 0.09);
}

.mini-table thead th {
    border-top: 1px solid rgba(127, 202, 225, 0.25);
}

.mini-table thead th:first-child,
.mini-table tbody td:first-child {
    border-left: 1px solid rgba(127, 202, 225, 0.25);
}

.mini-table thead th:last-child,
.mini-table tbody td:last-child {
    border-right: 1px solid rgba(127, 202, 225, 0.25);
}

.mini-table tbody tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 768px) {
    .login-card,
    .dashboard-panel {
        padding: 24px 20px;
    }

    .brand-block,
    .dashboard-topbar,
    .login-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-block {
        text-align: center;
    }

    .brand-logo {
        margin: 0 auto;
        width: 220px;
    }

    .brand-logo-wrap {
        width: auto;
        height: auto;
        margin: 0 auto;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-modal-dialog {
        max-height: 95dvh;
        border-radius: 16px;
        width: min(900px, 100%);
    }

    .editor-modal-body {
        padding: 16px;
    }

    .editor-section-cols {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-col-right {
        position: static;
    }

    .section-header {
        flex-direction: column;
    }

    .table-toolbar {
        grid-template-columns: 1fr;
        position: static;
    }

    .table-meta,
    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .split-2 {
        grid-template-columns: 1fr;
    }

    .bulk-groups-grid {
        grid-template-columns: 1fr;
    }

    .inline-tools {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-card,
    .info-card-wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .dashboard-grid-summary {
        grid-template-columns: 1fr;
    }

    .summary-help {
        margin-top: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Form Sections */
.form-section {
    padding: 20px;
    margin-bottom: 0;
    background: linear-gradient(180deg, rgba(250, 254, 255, 0.94), rgba(244, 251, 254, 0.9));
    border: 1px solid var(--editor-border);
    border-radius: 12px;
    display: grid;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.form-section:hover {
    background: linear-gradient(180deg, rgba(251, 255, 255, 0.98), rgba(245, 252, 255, 0.93));
    border-color: var(--editor-border-strong);
}

.form-section-final {
    background: linear-gradient(135deg, rgba(26, 177, 136, 0.06) 0%, rgba(16, 137, 170, 0.06) 100%);
    border: 2px solid rgba(26, 177, 136, 0.3);
    padding: 24px;
    margin-top: 0;
    box-shadow: 0 4px 16px rgba(26, 177, 136, 0.08);
}

.form-section-final:hover {
    background: linear-gradient(135deg, rgba(26, 177, 136, 0.1) 0%, rgba(16, 137, 170, 0.1) 100%);
    border-color: rgba(26, 177, 136, 0.5);
    box-shadow: 0 6px 20px rgba(26, 177, 136, 0.12);
}

/* Two-Column Editor Layout */
.editor-section-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 24px;
    align-items: start;
}

.form-col-left {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.form-col-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 6px;
}

.html-preview,
.push-device-grid {
    border-radius: 14px;
    border: 1px solid var(--editor-border);
    background: #ffffff;
    padding: 14px;
    max-height: 620px;
    overflow-y: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.preview-label {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--editor-text-strong);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- Aviso: campos avanzados colapsables ---- */
.aviso-advanced-fields {
    border: none;
    margin: 4px 0 0;
    padding: 0;
}

.aviso-advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--editor-text-muted);
    letter-spacing: 0.02em;
    padding: 5px 10px 5px 8px;
    border-radius: 20px;
    border: 1px solid var(--editor-border);
    background: var(--editor-surface-soft);
    margin-bottom: 8px;
    transition: background 0.16s, color 0.16s;
    -webkit-user-select: none;
    user-select: none;
}

.aviso-advanced-toggle::-webkit-details-marker { display: none; }
.aviso-advanced-toggle::marker { display: none; }

.aviso-advanced-toggle::before {
    content: '▶';
    font-size: 0.62rem;
    opacity: 0.6;
    transition: transform 0.18s;
}

.aviso-advanced-fields[open] > .aviso-advanced-toggle {
    color: #1187aa;
    background: rgba(17, 135, 170, 0.08);
    border-color: var(--editor-border-strong);
}

.aviso-advanced-fields[open] > .aviso-advanced-toggle::before {
    transform: rotate(90deg);
}

.aviso-advanced-fields:not([open]) > :not(.aviso-advanced-toggle) {
    display: none;
}

/* -------------------------------------------- */
.aviso-summary-card {
    border: 1px solid rgba(127, 202, 225, 0.28);
    background: linear-gradient(180deg, rgba(246, 252, 255, 0.92), rgba(238, 248, 253, 0.86));
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: grid;
    gap: 6px;
}

.aviso-summary-title {
    margin: 0 0 2px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #1c6e8d;
    text-transform: uppercase;
}

.aviso-summary-item {
    margin: 0;
    font-size: 0.83rem;
    color: #3f6677;
}

.section-title {
    margin: 0 0 4px 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--editor-text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--editor-text-muted);
    line-height: 1.4;
}

.editor-section-cols .field-group {
    opacity: 1;
    animation: none;
}

.editor-section-cols .field-group label {
    color: #1a6f8f;
}

/* HTML Editor & Preview Styles */
.field-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.field-header-row label {
    margin: 0;
    flex: 1;
}

.style-selector {
    padding: 8px 12px;
    border: 1px solid rgba(127, 202, 225, 0.4);
    border-radius: 6px;
    background: rgba(248, 251, 253, 0.7);
    color: var(--portal-ink);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.style-selector:hover {
    border-color: rgba(127, 202, 225, 0.6);
    background: rgba(248, 251, 253, 0.95);
}

.style-selector:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px rgba(16, 137, 170, 0.1);
}

.aviso-form-field {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 12px;
    border: 1px solid rgba(127, 202, 225, 0.4);
    border-radius: 8px;
    background: rgba(248, 251, 253, 0.7);
    resize: vertical;
    min-height: 44px;
    transition: all 0.2s ease;
}

.aviso-form-field:focus {
    outline: none;
    border-color: var(--portal-primary);
    background: white;
    box-shadow: 0 0 0 2px rgba(16, 137, 170, 0.1);
}

.aviso-form-field::placeholder {
    color: rgba(95, 135, 150, 0.6);
}

/* Color Picker Styling */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(248, 251, 253, 0.7);
    border: 1px solid rgba(127, 202, 225, 0.4);
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 0;
    flex-wrap: wrap;
}

.color-picker-wrap:focus-within {
    border-color: var(--portal-primary);
    background: white;
    box-shadow: 0 0 0 2px rgba(16, 137, 170, 0.1);
}

.color-picker {
    width: 50px;
    height: 44px;
    border: 2px solid rgba(127, 202, 225, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-picker:hover {
    border-color: var(--portal-primary);
    box-shadow: 0 2px 6px rgba(16, 137, 170, 0.15);
}

.color-picker-label {
    font-size: 0.95rem;
    color: var(--portal-ink);
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.field-hint {
    font-size: 0.85rem;
    color: var(--portal-muted);
    margin-top: 6px;
    padding: 8px;
    background: rgba(16, 137, 170, 0.05);
    border-radius: 6px;
    border-left: 3px solid rgba(16, 137, 170, 0.3);
}

.preview-section {
    margin-top: 12px;
    padding: 16px;
    background: rgba(16, 137, 170, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(127, 202, 225, 0.2);
    min-width: 0;
}

.preview-section .preview-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--portal-ink);
    margin: 0 0 12px 0;
}

.preview-section .html-preview {
    background: white;
    border-radius: 6px;
    padding: 16px;
    min-height: 120px;
    border: 1px solid rgba(127, 202, 225, 0.2);
    font-size: 0.95rem;
    line-height: 1.6;
    overflow: auto;
    max-height: 400px;
}

.preview-placeholder {
    color: rgba(95, 135, 150, 0.5);
    font-style: italic;
}

/* Push Notification Preview (Google-like compact panel) */
.push-preview-section {
    margin-top: 16px;
    padding: 16px;
    background: rgba(13, 21, 32, 0.94);
    border-radius: 10px;
    border: 1px solid rgba(127, 202, 225, 0.25);
    color: #dbe8ee;
    min-width: 0;
    overflow: hidden;
}

.push-preview-section .preview-label {
    color: #ffffff;
    margin-bottom: 6px;
}

.push-preview-help {
    margin: 0 0 10px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #8aa5b4;
}

.push-guidance {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: var(--editor-text-muted);
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(16, 137, 170, 0.08);
    border: 1px solid rgba(16, 137, 170, 0.18);
}

.push-truncate-warning {
    margin: -2px 0 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #b66a13;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(214, 147, 65, 0.35);
    background: rgba(251, 216, 160, 0.24);
}

.push-device-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(127, 202, 225, 0.3);
    background: rgba(243, 250, 254, 0.8);
    margin: 0 0 10px;
}

.push-device-tabs button {
    border: none;
    background: transparent;
    color: #5f8190;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
}

.push-device-tabs button.is-active {
    background: rgba(16, 137, 170, 0.16);
    color: #0d5f79;
}

.push-tabs {
    display: flex;
    gap: 18px;
    margin-bottom: 12px;
}

.push-tabs button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.84rem;
    color: #8ba4b2;
    font-weight: 600;
}

.push-tabs button.is-active {
    color: #6ca7ef;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.push-device-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: min(100%, 480px);
    max-width: 100%;
    margin: 0 auto;
}

.push-device-card {
    background: #f4f8fc;
    border: 1px solid rgba(139, 187, 209, 0.38);
    border-radius: 14px;
    padding: 10px;
    min-width: 0;
    overflow: hidden;
}

.push-device-name {
    margin: 0 0 8px;
    text-align: center;
    font-size: 0.8rem;
    color: #4c6e7e;
    font-weight: 700;
}

.push-device-notch {
    margin: 0 auto 8px;
    background: #d7e5ef;
    border-radius: 12px;
    position: relative;
}

.push-device-notch.android {
    width: 88%;
    height: 16px;
}

.push-device-notch.apple {
    width: 84%;
    height: 18px;
    border-radius: 18px;
}

.push-strip {
    background: #ffffff;
    border: 1px solid rgba(133, 182, 205, 0.35);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    min-width: 0;
    overflow: hidden;
}

.push-strip-expanded {
    display: block;
}

.push-strip[hidden],
.push-strip-expanded[hidden] {
    display: none !important;
}

.push-strip-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.push-app-name-inline {
    font-size: 0.78rem;
    color: #638392;
    font-weight: 600;
}

.push-app-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.push-strip-text {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.push-strip-text strong,
.push-strip-text span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.push-strip-text strong {
    font-size: 0.8rem;
    color: #1a4257;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.push-strip-text span {
    font-size: 0.75rem;
    color: #4f7080;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.push-strip-text.expanded-text span {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}

.field-limit {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--portal-muted);
    margin-left: 4px;
}

.field-limit.warning {
    color: #d97706;
    font-weight: 600;
}

.field-limit.error {
    color: var(--portal-danger);
    font-weight: 600;
}