.portal-page-ai-toggle {
    cursor: pointer;
}

u.portal-page-ai-toggle {
    display: inline;
    margin: 0;
    padding: 0;
}

.portal-page-ai {
    --navy: #1b1464;
    --theme: #1b1464;
    --navy-soft: #f3f4f7;
    --ink: #222222;
    --muted: #666666;
    --body: #444444;
    --line: #ececf4;
    --paper: #ffffff;
    --mist: #f6f7fb;
    display: none;
    margin: 0 0 18px;
    padding: 16px 18px 14px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--paper);
    color: var(--body);
    font-family: "Open Sans", "Segoe UI", sans-serif;
    line-height: 1.55;
}

.portal-page-ai-eyebrow {
    display: inline-block;
    margin: 0 0 10px;
    padding: 8px 18px;
    border: 1px solid var(--theme);
    border-radius: 50px;
    background: var(--paper);
    color: var(--theme);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.portal-page-ai-lede {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.portal-page-ai-kicker {
    margin: 10px 0 6px;
    color: var(--theme);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.portal-page-ai-card .portal-page-ai-kicker:first-child {
    margin-top: 0;
}

.portal-page-ai-card > .portal-page-ai-tile {
    margin-bottom: 8px !important;
}

.portal-page-ai-card {
    margin: 0;
    padding: 14px 14px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
    box-shadow: 0 8px 20px rgba(27, 20, 100, 0.05);
    overflow: visible;
}

.portal-page-ai-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    clear: both;
}

.portal-page-ai-choice {
    display: block;
    flex: 1 1 240px;
    box-sizing: border-box;
    padding: 14px 16px 14px;
    border: 1px solid var(--theme);
    border-radius: 16px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(27, 20, 100, 0.05);
}

.portal-page-ai-choice strong {
    display: block;
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.portal-page-ai-choice em {
    display: block;
    font-style: normal;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 400;
}

.portal-page-ai-choice:hover,
.portal-page-ai-choice:focus {
    outline: none;
    background: var(--mist);
    border-color: var(--theme);
    text-decoration: none;
}

.portal-page-ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
}

.portal-page-ai-title {
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
    margin: 0;
}

.portal-page-ai-close {
    cursor: pointer;
    color: #666;
    font-size: 13px;
    font-weight: 600;
}

.portal-page-ai-section {
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
}

.portal-page-ai-section-title {
    font-weight: 800;
    font-size: 14px;
    margin: 0 0 6px;
}

.portal-page-ai-help,
.portal-page-ai-status {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.portal-page-ai label {
    display: block;
    margin: 8px 0 4px;
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
}

.portal-page-ai select,
.portal-page-ai input[type="text"] {
    width: 100%;
    max-width: 520px;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
}

.portal-page-ai-tiles {
    display: grid;
    gap: 8px;
    margin: 0 0 8px;
}

.portal-page-ai-tiles-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-page-ai-tiles-3 {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.portal-page-ai-tiles-4 {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.portal-page-ai-tiles-5 {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.portal-page-ai-tile {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    margin: 0 !important;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 400 !important;
    cursor: pointer;
}

.portal-page-ai-tile span {
    display: block;
    line-height: 1.35;
}

.portal-page-ai-tile.on {
    background: var(--navy-soft);
    border-color: var(--theme);
    color: var(--ink);
    font-weight: 600 !important;
}

.portal-page-ai-tile input[type="checkbox"],
.portal-page-ai-tile input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex: 0 0 auto;
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
}

.portal-page-ai-tile .form-checkbox,
.portal-page-ai-tile .form-radio {
    display: none !important;
}

.portal-page-ai-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
    font-weight: 400 !important;
    cursor: pointer;
}

.portal-page-ai-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
}

.portal-page-ai-check .form-checkbox {
    display: none !important;
}

.portal-page-ai-types {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 6px 0 8px;
}

.portal-page-ai-types .portal-page-ai-check {
    min-width: 160px;
}

.modalDialog .portal-page-ai {
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.modalDialog .portal-page-ai-card {
    overflow: visible;
}

.modalDialog .portal-page-ai select,
.modalDialog .portal-page-ai input[type="text"] {
    max-width: 100%;
}

.portal-page-ai-image-source {
    display: none;
    margin: 8px 0 4px;
}

.portal-page-ai-image-source.on {
    display: block;
}

.portal-page-ai-paragraph-source,
.portal-page-ai-paragraph-wording {
    display: none;
    margin: 8px 0 4px;
}

.portal-page-ai-paragraph-source.on,
.portal-page-ai-paragraph-wording.on {
    display: block;
}

.portal-page-ai-assignment {
    display: none;
    margin: 10px 0 0;
    padding: 0;
    border: none;
    background: transparent;
}

.portal-page-ai-assignment.on {
    display: block;
}

.portal-page-ai-show-settings {
    display: inline-block;
    margin: 4px 0 0;
    padding: 8px 18px;
    border: 2px solid var(--theme);
    border-radius: 50px;
    background: #fff;
    color: var(--theme);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.portal-page-ai-show-settings:hover,
.portal-page-ai-show-settings:focus {
    background: var(--navy-soft);
    text-decoration: none;
}

.portal-page-ai-assignment-panel {
    margin-top: 10px;
    padding: 12px 12px 8px;
    border: 2px solid var(--theme);
    border-radius: 12px;
    background: var(--navy-soft);
}

.portal-page-ai-assignment-panel .portal-page-ai-kicker:first-of-type {
    margin-top: 0;
}

.portal-page-ai-assignment .portal-page-ai-tile {
    background: #fff;
}

.portal-page-ai-assignment .portal-page-ai-files {
    margin-bottom: 10px;
}

.portal-page-ai-type-picker {
    max-width: 100%;
    margin: 0 0 12px;
}

.portal-page-ai-type-tiles {
    margin-bottom: 4px;
}

.portal-page-ai-type-tiles .portal-page-ai-tile {
    padding: 6px 8px;
}

.portal-page-ai-slider-note,
.portal-page-ai-image-placeholder-note {
    display: none;
    margin: 8px 0 4px;
}

.portal-page-ai-slider-note.on,
.portal-page-ai-image-placeholder-note.on {
    display: block;
}

.portal-page-ai-more {
    display: inline-block;
    margin: 10px 0 8px;
    color: var(--theme);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.portal-page-ai-content-panel {
    display: none;
}

.portal-page-ai-content-panel.on {
    display: block;
}

.portal-page-ai-more-panel,
.portal-page-ai-extra {
    display: none;
}

.portal-page-ai-more-panel.on,
.portal-page-ai-extra.on {
    display: block;
}

.portal-page-ai-extra {
    margin: 8px 0 4px;
}

.portal-page-ai-extra > label {
    display: block;
    margin: 0 0 4px;
}

.portal-page-ai-extra input[type="text"] {
    width: 120px;
}

.portal-page-ai-radio {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-weight: 400 !important;
    cursor: pointer;
}

.portal-page-ai-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    cursor: pointer;
}

.portal-page-ai-note {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: #fff8e1;
    border: 1px solid #f0e0a0;
    border-radius: 12px;
    color: #5c4d17;
    font-size: 12px;
    line-height: 1.45;
    max-width: 640px;
}

.portal-page-ai-actions {
    margin-top: 12px;
}

.portal-page-ai-actions .btnSB2,
.btnPageElementAi {
    display: inline-block;
    cursor: pointer;
    padding: 6px 14px;
}

.portal-page-ai-btn {
    position: relative;
}

.portal-page-ai-spinner {
    display: none;
    width: 12px;
    height: 12px;
    margin: 0 8px 0 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: middle;
    -webkit-animation: portalPageAiSpin 0.7s linear infinite;
    animation: portalPageAiSpin 0.7s linear infinite;
}

.portal-page-ai-btn.busy .portal-page-ai-spinner,
.btnPageElementAi.busy:before {
    display: inline-block;
}

.btnPageElementAi.busy:before {
    content: "";
    width: 10px;
    height: 10px;
    margin: 0 6px 0 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: middle;
    -webkit-animation: portalPageAiSpin 0.7s linear infinite;
    animation: portalPageAiSpin 0.7s linear infinite;
}

.portalElementEditControlButtons .btnPageElementAi {
    background: transparent;
    background-image: none;
    color: inherit;
}

.portal-page-ai-btn.busy,
.btnPageElementAi.busy,
.portal-page-ai-toggle.on {
    opacity: 0.85;
}

.portal-page-ai-btn.busy,
.btnPageElementAi.busy {
    pointer-events: none;
}

@-webkit-keyframes portalPageAiSpin {
    to { -webkit-transform: rotate(360deg); }
}

@keyframes portalPageAiSpin {
    to { transform: rotate(360deg); }
}

.portal-page-ai-files {
    margin: 0 0 12px;
}

.portal-page-ai-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.portal-page-ai-file-pick {
    display: inline-block;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.portal-page-ai-file-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.portal-page-ai-file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 6px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.portal-page-ai-file-list a {
    color: var(--theme, #2a6);
    font-weight: 700;
    white-space: nowrap;
}

.portal-page-ai .portal-page-ai-upload-image {
    margin-top: 16px;
}

.portal-page-ai .lnkElementAiUploadImage {
    font-weight: 700;
}

.portal-page-ai-below-hint {
    font-weight: 600;
}

.portal-page-ai-digitize-warn {
    display: none;
    font-weight: 600;
}

.portal-page-ai-digitize-warn.on {
    display: block;
}

.portal-page-ai input[type="text"].portal-page-ai-guidance-locked {
    background: var(--mist, #f6f7fb);
    color: var(--muted, #666666);
    cursor: not-allowed;
}

.portal-page-ai-count-tiles.locked {
    opacity: 0.65;
}

.portal-page-ai-count-tiles.locked .portal-page-ai-tile {
    cursor: not-allowed;
}

.modalButtons .portal-page-ai-confirm-note {
    clear: both;
    margin: 0 0 10px;
    color: #1b1464;
    font-size: 13px;
    font-weight: 600;
}

a.portal-page-ai-btn-confirm {
    width: auto;
    min-width: 99px;
    padding: 0 16px;
}

.portal-page-ai-overflow-fade {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    height: 42px;
    z-index: 15;
    pointer-events: none;
    background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), #ffffff);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff);
}

.portal-page-ai-overflow {
    display: none;
    position: absolute;
    right: 14px;
    bottom: 58px;
    z-index: 20;
    width: 34px;
    height: 34px;
    border: 1px solid #ececf4;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(27, 20, 100, 0.12);
    cursor: pointer;
    text-decoration: none;
}

.portal-page-ai-overflow:hover,
.portal-page-ai-overflow:focus {
    background: #f3f4f7;
    text-decoration: none;
}

.portal-page-ai-overflow span {
    position: absolute;
    left: 50%;
    top: 12px;
    width: 8px;
    height: 8px;
    margin-left: -5px;
    border-right: 2px solid #1b1464;
    border-bottom: 2px solid #1b1464;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
}

.portal-page-ai-overflow.up span {
    top: 14px;
    -webkit-transform: rotate(-135deg);
    transform: rotate(-135deg);
}

.portal-page-ai-overflow:not(.up) {
    -webkit-animation: portalPageAiBob 1.15s ease-in-out infinite;
    animation: portalPageAiBob 1.15s ease-in-out infinite;
}

@-webkit-keyframes portalPageAiBob {
    0%, 100% { -webkit-transform: translateY(0); transform: translateY(0); }
    50% { -webkit-transform: translateY(5px); transform: translateY(5px); }
}

@keyframes portalPageAiBob {
    0%, 100% { -webkit-transform: translateY(0); transform: translateY(0); }
    50% { -webkit-transform: translateY(5px); transform: translateY(5px); }
}

@media (max-width: 560px) {
    .portal-page-ai-tiles-2,
    .portal-page-ai-tiles-5 {
        grid-template-columns: 1fr 1fr;
    }
}
