.custom-modal-overlay {
    position: fixed; inset: 0;
    background: var(--modal-overlay-bg, rgba(0,0,0,0.45));
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
}
.custom-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,1.6);
    padding: 20px;
    width: fit-content;
    min-width: 480px;
    max-width: min-content;
    font-family: sans-serif;
    position: relative;
    animation: fadeIn 0.2s ease;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    gap: 4px;
}

/* Draggable modals (confirm) */
.custom-modal.is-draggable .custom-modal-title,
.custom-modal.is-draggable .custom-modal-content {
    cursor: grab;
}
body.modal-dragging {
    user-select: none;
}
body.modal-dragging .custom-modal.is-draggable .custom-modal-title,
body.modal-dragging .custom-modal.is-draggable .custom-modal-content {
    cursor: grabbing;
}
.custom-modal h3 {
    margin: 0 0 10px;
    font-size: 18px;
}
.custom-modal.error h3 { color: #c62828; }

.custom-modal-title {
    max-width: 30%;
    display: grid;
    flex: 0 0 auto;
    padding: 10px;
    align-items: center;
    justify-content: center;
}

.custom-modal-title img, .custom-modal-title svg {
    max-width: 100%;
    max-height: 64px;
    object-fit: contain;
}
.custom-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.custom-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.custom-modal-body p {
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
}

/* ============================
   New Year greeting (dashboard)
   ============================ */

.custom-modal.ny2025-modal {
    width: min(480px, 90vw);
    max-width: 90vw;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
    animation: nyPop 0.22s ease-out;
}

.custom-modal.ny2025-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 18px 18px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.ny2025-modal .custom-modal-content {
    padding: 0 18px 16px;
}

.custom-modal.ny2025-modal .custom-modal-body p {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.ny2025-modal .ny2025-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-align: center;
}

.custom-modal.ny2025-modal .ny2025-text {
    font-size: 14px;
    color: #374151;
    text-align: center;
}

.custom-modal.ny2025-modal .ny2025-illustration {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 12px;
    background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.16), rgba(255,255,255,0) 55%),
                radial-gradient(circle at 80% 30%, rgba(16,185,129,0.16), rgba(255,255,255,0) 55%),
                linear-gradient(180deg, rgba(59,130,246,0.10), rgba(255,255,255,0));
    padding: 10px 10px;
}

.custom-modal.ny2025-modal .custom-modal-buttons {
    justify-content: center;
}

.custom-modal.ny2025-modal .btn-ok {
    min-width: 200px;
}

@keyframes nyPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Feedback thread timestamps */
.fb-thread-author {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.fb-thread-time {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}
.custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal-body textarea.modalInput {
    width: 100%;
    height: 40px;
    padding: 8px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}
.custom-modal-body select.modalInput {
    width: 100%;
    padding: 8px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    background: #fff;
}
.custom-modal-body textarea.modalInput {
    resize: vertical;
    min-height: 80px;
}

/* Lesson editor: add text modal */
.custom-modal.add-text-modal {
    width: min(720px, 92vw);
    font-family: var(--app-theme-font-family, inherit);
    color: var(--text-primary);
}

.custom-modal.add-text-modal .custom-modal-title img {
    width: 40px;
    height: 40px;
}

.custom-modal.add-text-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.add-text-modal textarea.modalInput {
    min-height: 148px;
    resize: vertical;
    line-height: 1.45;
    tab-size: 4;
}

.custom-modal.add-text-modal .modal-field {
    display: grid;
    gap: 8px;
}

.custom-modal.add-text-modal .modal-field__label {
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs);
    font-weight: 700;
    line-height: 1.35;
}

.context-menu.v2.add-text-modal-context {
    z-index: 10020;
}

.context-menu.v2.modal-input-context {
    z-index: 10020;
}

.modal-switch {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

.modal-switch:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.modal-switch.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: var(--bg-app, #f8fafc);
}

.modal-switch__copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.modal-switch__label {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-switch__hint {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.modal-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-switch__track {
    position: relative;
    width: 52px;
    height: 30px;
    flex: 0 0 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.modal-switch__track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transform: translateY(-50%);
    transition: left 0.18s ease;
    z-index: 1;
}

.modal-switch input:checked + .modal-switch__track {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
}

.modal-switch input:checked + .modal-switch__track::after {
    left: 23px;
}

.modal-switch input:focus-visible + .modal-switch__track {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.modal-switch__icons {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px;
    box-sizing: border-box;
}

.modal-switch__icons img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.74;
}

.modal-switch input:checked + .modal-switch__track .modal-switch__icons img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.modal-segmented {
    display: grid;
    gap: 8px;
}

.modal-segmented__label {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-segmented__track {
    --modal-segment-count: 3;
    --modal-segment-index: 0;
    --modal-segment-gap: 4px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--modal-segment-count), minmax(0, 1fr));
    gap: var(--modal-segment-gap);
    padding: 4px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    box-sizing: border-box;
}

.modal-segmented__track::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 8px - ((var(--modal-segment-count) - 1) * var(--modal-segment-gap))) / var(--modal-segment-count));
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    border: 1px solid var(--accent-primary, #2563eb);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
    transform: translateX(calc(var(--modal-segment-index) * (100% + var(--modal-segment-gap))));
    transition: transform 0.18s ease;
    box-sizing: border-box;
    z-index: 0;
}

.modal-segmented__option {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.modal-segmented__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-segmented__button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.modal-segmented__button:hover {
    color: var(--text-primary, #0f172a);
    background: var(--accent-soft, #eff6ff);
}

.modal-segmented__button img {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    object-fit: contain;
    opacity: 0.82;
}

.modal-segmented__option input:checked + .modal-segmented__button {
    color: var(--text-primary, #0f172a);
}

.modal-segmented__option input:checked + .modal-segmented__button img {
    opacity: 1;
}

.modal-segmented__option input:focus-visible + .modal-segmented__button {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}
.custom-modal.board-editor-modal {
    width: min(640px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.custom-modal.board-editor-modal.add-text-modal {
    width: min(720px, 92vw);
    border-radius: var(--radius-xl);
    border-color: var(--border-default);
    background: var(--bg-panel);
    box-shadow: 0 24px 56px color-mix(in srgb, var(--text-primary) 16%, transparent);
    color: var(--text-primary);
    font-family: var(--app-theme-font-family, inherit);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-title {
    background: linear-gradient(180deg, var(--accent-soft), var(--bg-muted));
    border-right-color: var(--border-default);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-content {
    background: var(--bg-panel);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-close {
    border-color: var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-secondary);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-close:hover {
    background: var(--accent-soft);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-close:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 24%, transparent);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-body > p:first-child {
    color: var(--text-primary);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-title);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-body textarea.modalInput {
    border-color: var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-md);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-body textarea.modalInput:focus {
    border-color: var(--accent-primary);
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
    outline-offset: 1px;
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-body textarea.modalInput::placeholder {
    color: var(--text-muted);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch,
.custom-modal.board-editor-modal.add-text-modal .modal-segmented__button {
    border-color: var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-family: var(--app-theme-font-family, inherit);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch:hover,
.custom-modal.board-editor-modal.add-text-modal .modal-segmented__button:hover {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch__label,
.custom-modal.board-editor-modal.add-text-modal .modal-segmented__label {
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-sm);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch__hint {
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch__track {
    background: var(--bg-muted);
    border-color: var(--border-default);
}

.custom-modal.board-editor-modal.add-text-modal .modal-switch input:checked + .modal-switch__track {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.custom-modal.board-editor-modal.add-text-modal .modal-segmented__track {
    background: var(--bg-muted);
    border-color: var(--border-default);
    border-radius: var(--radius-md);
}

.custom-modal.board-editor-modal.add-text-modal .modal-segmented__option input:checked + .modal-segmented__button {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
    color: var(--accent-primary);
}

.custom-modal.board-editor-modal.add-text-modal .modal-segmented__option input:focus-visible + .modal-segmented__button {
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 24%, transparent);
}

.custom-modal.board-editor-modal.add-text-modal .custom-modal-buttons button {
    border-radius: var(--radius-sm);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-sm);
}

.custom-modal.board-editor-modal.add-text-modal .btn-ok {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-on-accent);
}

.custom-modal.board-editor-modal.add-text-modal .btn-ok:hover,
.custom-modal.board-editor-modal.add-text-modal .btn-ok:focus-visible {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

.custom-modal.board-editor-modal.add-text-modal .btn-cancel {
    border-color: var(--border-default);
    background: var(--bg-panel);
    color: var(--text-primary);
}

.custom-modal.board-editor-modal.add-text-modal .btn-cancel:hover,
.custom-modal.board-editor-modal.add-text-modal .btn-cancel:focus-visible {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
    color: var(--accent-primary);
}

.custom-modal.board-editor-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid var(--border-default, #dbe5f0);
}

.custom-modal.board-editor-modal .custom-modal-title img,
.custom-modal.board-editor-modal .custom-modal-title svg {
    width: 64px;
    height: 64px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.custom-modal.board-editor-modal .custom-modal-content {
    padding: 20px 20px 18px;
    gap: 18px;
    position: static;
}

.custom-modal.board-editor-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.board-editor-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.board-editor-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.board-editor-modal .custom-modal-close:hover img,
.custom-modal.board-editor-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.board-editor-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.board-editor-modal .custom-modal-body {
    gap: 14px;
}

.custom-modal.board-editor-modal .custom-modal-body > p:first-child {
    margin: 0;
    padding-right: 52px;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.board-editor-modal h3 {
    margin: 0;
    padding-right: 52px;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.board-editor-modal .custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal.board-editor-modal .custom-modal-body textarea.modalInput,
.custom-modal.board-editor-modal .custom-modal-body select.modalInput {
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
}

.custom-modal.board-editor-modal .custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal.board-editor-modal .custom-modal-body select.modalInput {
    height: 46px;
    padding: 0 14px;
}

.custom-modal.board-editor-modal .custom-modal-body textarea.modalInput {
    min-height: 80px;
    max-height: 240px;
    padding: 12px 14px;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio {
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
}

.custom-modal.board-editor-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.board-editor-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.board-editor-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal {
    width: min(660px, 94vw);
    min-width: min(480px, 94vw);
    border-radius: var(--radius-xl, 22px);
    font-family: var(--app-theme-font-family, inherit);
}

/* Direct marketplace receipt confirmation shared by /orders and Dashboard v2. */
.custom-modal.direct-payment-confirmation-modal {
    width: min(460px, calc(100vw - 32px));
    min-width: 0;
    max-width: 460px;
    padding: 32px;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    background: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-modal);
    font-family: var(--app-theme-font-family);
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-title {
    width: auto;
    max-width: none;
    padding: 0;
    display: flex;
    justify-content: flex-start;
}

.direct-payment-confirmation__icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--accent-primary);
    box-shadow: var(--shadow-accent);
}

.custom-modal.direct-payment-confirmation-modal .direct-payment-confirmation__icon img {
    width: 28px;
    height: 28px;
    max-width: none;
    max-height: none;
    filter: brightness(0) invert(1);
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-content {
    gap: 28px;
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-close {
    top: -66px;
    right: 0;
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-body,
.custom-modal.direct-payment-confirmation-modal .custom-modal-body > p:first-child {
    display: block;
    margin: 0;
}

.direct-payment-confirmation {
    display: grid;
    gap: 22px;
    font-size: var(--app-theme-font-size-md);
}

.direct-payment-confirmation__header {
    display: grid;
    gap: 5px;
}

.direct-payment-confirmation__header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-title);
    line-height: 1.25;
}

.direct-payment-confirmation__header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-sm);
    line-height: 1.4;
}

.direct-payment-confirmation__details {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-muted);
}

.direct-payment-confirmation__details > div {
    min-width: 0;
    padding: 13px 12px;
    display: grid;
    align-content: start;
    gap: 4px;
}

.direct-payment-confirmation__details > div + div {
    border-left: 1px solid var(--border-default);
}

.direct-payment-confirmation__details dt {
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.direct-payment-confirmation__details dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-md);
    font-weight: 700;
    line-height: 1.25;
}

.direct-payment-confirmation__details dd.direct-payment-confirmation__amount {
    color: var(--accent-primary);
}

.direct-payment-confirmation__statement {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-md);
    line-height: 1.45;
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
    gap: 10px;
}

.custom-modal.direct-payment-confirmation-modal .custom-modal-buttons button {
    min-height: 42px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font: 700 var(--app-theme-font-size-sm) / 1.2 var(--app-theme-font-family);
}

.custom-modal.direct-payment-confirmation-modal .btn-cancel {
    border: 1px solid var(--border-default);
    background: var(--bg-panel);
    color: var(--text-primary);
}

.custom-modal.direct-payment-confirmation-modal .btn-ok {
    border: 1px solid var(--accent-primary);
    background: var(--accent-primary);
    color: var(--text-on-accent);
}

.custom-modal.direct-payment-confirmation-modal .btn-ok:hover,
.custom-modal.direct-payment-confirmation-modal .btn-ok:focus-visible {
    border-color: var(--accent-primary-hover);
    background: var(--accent-primary-hover);
}

@media (max-width: 560px) {
    .custom-modal.direct-payment-confirmation-modal {
        padding: 24px 20px;
    }

    .direct-payment-confirmation__details {
        grid-template-columns: 1fr;
    }

    .direct-payment-confirmation__details > div + div {
        border-top: 1px solid var(--border-default);
        border-left: 0;
    }

    .custom-modal.direct-payment-confirmation-modal .custom-modal-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* ===============================================================
   Trial booking confirmation dialog (/tutor/{id}).
   docs/gui-redesign/tutor-profile/design-brief.md §18-29.
   Scoped modalClass for the single `type:"confirm"` call site in
   handleSlotPick() (static/js/pages/tutor_public.js). Modelled on
   direct-payment-confirmation-modal directly above: same S-width
   sizing (README_CSS.md §2.14 "Ширина"), same <=560px stacked
   footer. Fixes, scoped to this class only:
   - C1 mobile overflow: width min(420px, 100vw-32px)/min-width:0
     instead of the unclassed shell's 480px min-width.
   - M2 no close control: re-enables .custom-modal-close (display:
     none by default) and positions it in the header row.
   - M3 structural mismatch: flex-direction: column turns the
     legacy title|content split into a header -> body -> footer
     stack.
   C2 (Escape) / M1 (focus-on-open) and the slot-value focus-return
   are fixed at the call site (tabindex="-1" + .focus() on the
   dialog container), not here, so the shared unclassed defaults and
   every other confirm dialog in the app stay untouched.
   =============================================================== */
.custom-modal.trial-booking-confirmation-modal {
    width: min(420px, calc(100vw - 32px));
    min-width: 0;
    max-width: 420px;
    max-height: calc(100dvh - 32px);
    padding: 0;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-modal);
    font-family: var(--app-theme-font-family);
}
@supports not (height: 100dvh) {
    .custom-modal.trial-booking-confirmation-modal {
        max-height: calc(100vh - 32px);
    }
}
/* The dialog container itself takes focus on open (call-site fix for
   C2/M1), so it needs its own ring — lighter than a control's, so it
   reads as "you are here" rather than a second accent surface. */
.custom-modal.trial-booking-confirmation-modal:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 55%, transparent);
    outline-offset: 2px;
}

/* Header: icon tile + title, close button pulled into the row.
   Header and footer never scroll; only the body does. */
.custom-modal.trial-booking-confirmation-modal .custom-modal-title {
    box-sizing: border-box;
    max-width: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 52px 14px 16px;
    border-bottom: 1px solid var(--border-default);
    justify-content: flex-start;
    position: relative;
}
.trial-booking-confirmation__icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-primary);
}
.trial-booking-confirmation__icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.trial-booking-confirmation__title {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: var(--app-theme-font-size-title-base);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}
.custom-modal.trial-booking-confirmation-modal .custom-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: transform .18s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.custom-modal.trial-booking-confirmation-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
}
.custom-modal.trial-booking-confirmation-modal .custom-modal-close:hover,
.custom-modal.trial-booking-confirmation-modal .custom-modal-close:focus-visible {
    background: var(--bg-muted);
    border-color: var(--border-default);
    color: var(--text-primary);
    transform: rotate(90deg);
    outline: none;
}

/* Body: the only scrolling region, so a tall dialog (long localized
   copy) stays reachable from its top edge instead of clipping the
   header/footer. */
.custom-modal.trial-booking-confirmation-modal .custom-modal-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.custom-modal.trial-booking-confirmation-modal .custom-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}
/* The generic primitive wraps the `message` HTML in a <p>; this dialog's
   content is built from <span>s (see tutor_public.js), which keeps that
   <p> valid while still letting each part lay out as a block/grid. */
.custom-modal.trial-booking-confirmation-modal .custom-modal-body > p:first-child {
    display: grid;
    gap: 12px;
    margin: 0;
}

.trial-booking-confirmation__summary {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-muted);
}
.trial-booking-confirmation__what {
    display: block;
    font-size: var(--app-theme-font-size-md);
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.trial-booking-confirmation__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.trial-booking-confirmation__fact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs);
}
.trial-booking-confirmation__fact b {
    color: var(--text-primary);
    font-weight: 700;
}
.trial-booking-confirmation__fact--free,
.trial-booking-confirmation__fact--free b {
    color: var(--success);
}
/* The "when" value is always longer than a first name, so the track
   ratio is set to the content rather than split evenly. */
.trial-booking-confirmation__grid {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    border-top: 1px solid var(--border-default);
}
.trial-booking-confirmation__cell {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 3px;
    padding: 10px 12px 2px 0;
}
.trial-booking-confirmation__cell + .trial-booking-confirmation__cell {
    padding-left: 12px;
    border-left: 1px solid var(--border-default);
}
.trial-booking-confirmation__label {
    display: block;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.trial-booking-confirmation__value {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-md);
    font-weight: 700;
    line-height: 1.3;
}
.trial-booking-confirmation__when-date {
    display: block;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-sm);
}
.trial-booking-confirmation__when-time {
    display: block;
    font-variant-numeric: tabular-nums;
}
.trial-booking-confirmation__hint {
    display: block;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-sm);
    line-height: 1.45;
}

/* Footer: never scrolls, secondary then primary, primary dominant —
   the only saturated accent surface in the dialog. */
.custom-modal.trial-booking-confirmation-modal .custom-modal-buttons {
    flex: 0 0 auto;
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-default);
}
.custom-modal.trial-booking-confirmation-modal .custom-modal-buttons button {
    min-height: 42px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font: 700 var(--app-theme-font-size-sm) / 1.2 var(--app-theme-font-family);
}
.custom-modal.trial-booking-confirmation-modal .btn-cancel {
    border: 1px solid var(--border-default);
    background: var(--bg-panel);
    color: var(--text-primary);
}
.custom-modal.trial-booking-confirmation-modal .btn-cancel:hover,
.custom-modal.trial-booking-confirmation-modal .btn-cancel:focus-visible {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
}
.custom-modal.trial-booking-confirmation-modal .btn-ok {
    border: 1px solid var(--accent-primary);
    background: var(--accent-primary);
    color: var(--text-on-accent);
}
.custom-modal.trial-booking-confirmation-modal .btn-ok:hover,
.custom-modal.trial-booking-confirmation-modal .btn-ok:focus-visible {
    border-color: var(--accent-primary-hover);
    background: var(--accent-primary-hover);
}

/* <=560: the dialog fills the width it is given and the two actions
   stack full-width, primary last (DOM order already puts .btn-ok
   second). Matches direct-payment-confirmation-modal, the only other
   shared modal variant with a mobile footer rule. */
@media (max-width: 560px) {
    .custom-modal.trial-booking-confirmation-modal {
        max-height: calc(100dvh - 24px);
    }
    .trial-booking-confirmation__grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .trial-booking-confirmation__cell {
        padding: 10px 0 2px;
    }
    .trial-booking-confirmation__cell + .trial-booking-confirmation__cell {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--border-default);
    }
    .custom-modal.trial-booking-confirmation-modal .custom-modal-buttons {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }
    .custom-modal.trial-booking-confirmation-modal .custom-modal-buttons button {
        width: 100%;
        min-height: 48px;
    }
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-title {
    width: 132px;
    padding: 28px 18px;
    align-items: center;
    background: linear-gradient(180deg, var(--accent-soft, #eff6ff), var(--bg-muted, #f8fafc));
    border-right-color: var(--border-default, #dbe5f0);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__header {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-md, 14px);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--text-primary, #0f172a) 8%, transparent);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__icon img {
    width: 46px;
    height: 46px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__flow-arrow {
    width: 36px;
    height: 48px;
    display: block;
    object-fit: contain;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__headline {
    display: block;
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-title, 20px);
    font-weight: 800;
    line-height: 1.28;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__intro {
    display: block;
    color: var(--text-secondary, #475569);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 500;
    line-height: 1.4;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-content {
    min-width: 0;
    padding: 28px 28px 20px;
    gap: 24px;
    background: var(--bg-panel, #ffffff);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body {
    gap: 20px;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body > p:first-child {
    display: grid;
    gap: 6px;
    padding-right: 52px;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio-group {
    gap: 10px;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio-group__label,
.custom-modal.board-editor-modal.pdf-image-convert-modal .modal-field__label {
    color: var(--text-secondary, #475569);
    font-size: var(--app-theme-font-size-xs, 13px);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    text-transform: none;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio {
    min-height: 62px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 20px;
    padding: 10px 14px 10px 12px;
    gap: 12px;
    border-color: var(--border-default, #dbe5f0);
    border-radius: var(--radius-md, 14px);
    background: var(--bg-panel, #ffffff);
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio::before {
    content: "";
    width: 40px;
    height: 40px;
    grid-column: 1;
    grid-row: 1;
    background-color: var(--text-secondary, #475569);
    -webkit-mask: center / 22px 22px no-repeat url("/static/assets/icons/files.svg");
    mask: center / 22px 22px no-repeat url("/static/assets/icons/files.svg");
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio:has(input[value="custom"])::before {
    -webkit-mask-image: url("/static/assets/icons/list.svg");
    mask-image: url("/static/assets/icons/list.svg");
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio > span {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 600;
    line-height: 1.35;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio:hover {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-soft, #eff6ff);
    transform: translateY(-1px);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-soft, #eff6ff);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-primary, #2563eb) 16%, transparent);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked)::before {
    background-color: var(--accent-primary, #2563eb);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 50%;
    appearance: none;
    background: var(--bg-panel, #ffffff);
    accent-color: var(--accent-primary, #2563eb);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio input[type="radio"]:checked {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 5px var(--bg-panel, #ffffff);
    background: var(--accent-primary, #2563eb);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio input[type="radio"]:focus {
    outline: none;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body .modal-radio:has(input[type="radio"]:focus-visible) {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #2563eb) 16%, transparent);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .modal-field {
    display: grid;
    gap: 10px;
    padding-top: 2px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, visibility 0s linear 0.16s;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal.is-custom-pages .modal-field {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body input.modalInput:not([type="checkbox"]) {
    height: 46px;
    border-color: var(--border-default, #dbe5f0);
    border-radius: var(--radius-sm, 10px);
    background: var(--bg-panel, #ffffff);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-md, 15px);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body input.modalInput:not([type="checkbox"]):focus {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #2563eb) 16%, transparent);
    outline: none;
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-buttons {
    padding-top: 18px;
    border-top: 1px solid var(--border-default, #dbe5f0);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-buttons button {
    min-width: 116px;
    min-height: 44px;
    border-radius: var(--radius-sm, 10px);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-sm, 14px);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    border-color: var(--accent-primary, #2563eb);
    color: var(--text-on-accent, #ffffff);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-ok:hover,
.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-ok:focus-visible {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-cancel {
    background: var(--bg-panel, #ffffff);
    border-color: var(--border-default, #dbe5f0);
    color: var(--text-primary, #0f172a);
}

.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-cancel:hover,
.custom-modal.board-editor-modal.pdf-image-convert-modal .btn-cancel:focus-visible {
    background: var(--accent-soft, #eff6ff);
    border-color: var(--accent-primary, #2563eb);
    color: var(--accent-primary, #2563eb);
}

.custom-modal.board-editor-modal.pdf-drop-mode-modal {
    width: min(420px, 92vw);
    min-width: min(320px, 92vw);
    padding: 0;
}

.custom-modal.board-editor-modal.pdf-drop-mode-modal .custom-modal-close {
    top: 14px;
    right: 14px;
}

.pdf-drop-mode-modal__body {
    display: grid;
    gap: 18px;
    padding: 28px 26px 24px;
}

.pdf-drop-mode-modal__body h3 {
    margin: 0;
    padding-right: 42px;
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-title-base, 18px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

.pdf-drop-mode-modal__actions {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
}

.pdf-drop-mode-modal__choice {
    min-width: 132px;
    padding: 14px 16px 12px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-md, 14px);
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.pdf-drop-mode-modal__choice:hover,
.pdf-drop-mode-modal__choice:focus-visible {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-soft, #eff6ff);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-primary, #2563eb) 14%, transparent);
    outline: none;
    transform: translateY(-1px);
}

.pdf-drop-mode-modal__choice img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
}

.pdf-drop-mode-modal__choice span {
    line-height: 1.2;
}

@media (max-width: 640px) {
    .custom-modal.board-editor-modal.pdf-image-convert-modal {
        max-height: min(92vh, 720px);
        width: min(420px, 94vw);
        min-width: min(320px, 94vw);
        flex-direction: column;
        overflow-y: auto;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-title {
        width: 100%;
        padding: 16px 20px;
        box-sizing: border-box;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__header {
        min-height: 0;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__icon {
        width: 52px;
        height: 52px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__icon img {
        width: 38px;
        height: 38px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__flow-arrow {
        width: 28px;
        height: 36px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-content {
        padding: 20px;
        gap: 20px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-body {
        gap: 16px;
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .pdf-image-convert-modal__headline {
        font-size: var(--app-theme-font-size-lg, 17px);
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .custom-modal.board-editor-modal.pdf-image-convert-modal .custom-modal-buttons button {
        min-width: 0;
    }
}

.custom-modal.graph-settings-modal {
    width: min(880px, 94vw);
    min-width: min(720px, 94vw);
    max-height: 88vh;
}

.custom-modal.graph-settings-modal,
.custom-modal.graph-settings-modal * {
    box-sizing: border-box;
}

.custom-modal.graph-settings-modal .custom-modal-title {
    width: 128px;
    padding: 20px 14px;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.graph-settings-modal .custom-modal-title img {
    width: 32px;
    height: 32px;
}

.custom-modal.graph-settings-modal .custom-modal-content {
    width: 100%;
    min-width: 0;
    max-height: 88vh;
}

.custom-modal.graph-settings-modal .graph-settings__rail-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-panel, #ffffff);
}

.custom-modal.graph-settings-modal .graph-settings__rail-title {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.custom-modal.graph-settings-modal .graph-settings__form {
    max-height: min(620px, calc(88vh - 116px));
    overflow: auto;
    padding-right: 10px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong, #94a3b8) var(--bg-app, #f8fafc);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar {
    width: 10px;
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-track {
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-thumb {
    border: 2px solid var(--bg-app, #f8fafc);
    border-radius: 999px;
    background: var(--border-strong, #94a3b8);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #475569);
}

.custom-modal.graph-settings-modal .graph-settings__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-right: 46px;
}

.custom-modal.graph-settings-modal .graph-settings__section {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-panel, #ffffff);
}

.custom-modal.graph-settings-modal .graph-settings__section-title {
    margin: 0 0 12px;
    padding: 0;
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__section-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.graph-settings-modal .graph-settings__fields-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.graph-settings-modal .graph-settings__field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-modal.graph-settings-modal .graph-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__input[type="color"] {
    padding: 4px;
}

.custom-modal.graph-settings-modal .graph-settings__input:focus {
    border-color: var(--accent-primary, #2563eb);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.custom-modal.graph-settings-modal .graph-settings__toggle-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-modal.graph-settings-modal .graph-settings__toggle {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-app, #f8fafc);
    cursor: pointer;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-copy {
    min-width: 0;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-track {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--border-strong, #cbd5e1);
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
    transition: transform 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:checked + .graph-settings__toggle-track {
    background: var(--accent-primary, #2563eb);
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:checked + .graph-settings__toggle-track::after {
    transform: translateX(18px);
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:focus-visible + .graph-settings__toggle-track {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

@media (max-width: 760px) {
    .custom-modal.graph-settings-modal {
        min-width: min(420px, 94vw);
    }

    .custom-modal.graph-settings-modal .custom-modal-title {
        width: auto;
        min-height: 86px;
        flex-direction: row;
        justify-content: flex-start;
    }

    .custom-modal.graph-settings-modal .graph-settings__rail-title {
        text-align: left;
    }

    .custom-modal.graph-settings-modal .graph-settings__grid {
        grid-template-columns: 1fr;
        padding-right: 0;
    }

    .custom-modal.graph-settings-modal .graph-settings__fields-2 {
        grid-template-columns: 1fr;
    }
}

.custom-modal.wordpoint-check-mode-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-check-mode-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio:hover {
    border-color: #bfdbfe;
    background: rgba(248, 250, 252, 0.96);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary, #2563eb);
    background: rgba(239, 246, 255, 0.96);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio input[type="radio"] {
    margin-top: 1px;
    flex: 0 0 auto;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio span {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-check-mode-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-check-mode-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-check-mode-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.wordpoint-check-mode-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-check-mode-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons button {
    flex: 1 1 160px;
}
}

.custom-modal.crossword-warning-modal {
    width: min(500px, 92vw);
    min-width: min(380px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.crossword-warning-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.crossword-warning-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.crossword-warning-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.crossword-warning-modal .custom-modal-close:hover img,
.custom-modal.crossword-warning-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.crossword-warning-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(253, 230, 138, 0.95);
    background: rgba(255, 251, 235, 0.98);
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__eyebrow {
    color: var(--warning, #d97706);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.crossword-warning-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons .btn-ok {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

.custom-modal.crossword-create-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.crossword-create-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.crossword-create-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.crossword-create-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.crossword-create-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.crossword-create-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.crossword-create-modal .custom-modal-close:hover img,
.custom-modal.crossword-create-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.crossword-create-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.crossword-create-modal .crossword-create-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.crossword-create-modal .crossword-create-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.crossword-create-modal .crossword-create-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.crossword-create-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.crossword-create-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio:hover {
    border-color: #bfdbfe;
    background: rgba(248, 250, 252, 0.96);
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary, #2563eb);
    background: rgba(239, 246, 255, 0.96);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio input[type="radio"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio span {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    line-height: 1.45;
}

.custom-modal.crossword-create-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.crossword-create-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.crossword-create-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
}

@media (max-width: 640px) {
    .custom-modal.crossword-warning-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.crossword-warning-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.crossword-warning-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.crossword-warning-modal .crossword-warning-modal__header {
        align-items: flex-start;
    }

    .custom-modal.crossword-create-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.crossword-create-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.crossword-create-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.crossword-create-modal .crossword-create-modal__header {
        align-items: flex-start;
    }
}

.custom-modal.wordpoint-finish-modal {
    width: min(500px, 92vw);
    min-width: min(400px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-finish-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-finish-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-finish-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-finish-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-finish-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-finish-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-finish-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-finish-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.wordpoint-finish-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-finish-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-buttons button {
        flex: 1 1 160px;
    }
}

.custom-modal.wordpoint-delete-modal {
    width: min(500px, 92vw);
    min-width: min(400px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-delete-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-delete-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(254, 205, 211, 0.96);
    background: rgba(254, 242, 242, 0.98);
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__eyebrow {
    color: var(--danger, #dc2626);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-delete-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-delete-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-delete-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-delete-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-delete-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-delete-modal .btn-ok {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.custom-modal.wordpoint-delete-modal .btn-ok:hover {
    background: #dc2626;
    border-color: #dc2626;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-delete-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-buttons button {
        flex: 1 1 160px;
    }
}

.custom-modal.snapshot-save-status-modal {
    width: min(560px, 92vw);
    min-width: min(420px, 92vw);
}

.custom-modal.snapshot-save-status-modal .custom-modal-title {
    width: 112px;
    padding: 20px 18px;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__icon-shell {
    width: 64px;
    height: 64px;
    padding: 4px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--warning-bg, #fef3c7);
    box-sizing: border-box;
}

.custom-modal.snapshot-save-status-modal.snapshot-save-status-modal--forbidden .snapshot-save-status-modal__icon-shell {
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.snapshot-save-status-modal .custom-modal-title img {
    width: 56px;
    height: 56px;
}

.custom-modal.snapshot-save-status-modal .custom-modal-content {
    padding: 22px 22px 20px;
    gap: 20px;
}

.custom-modal.snapshot-save-status-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.snapshot-save-status-modal .custom-modal-body > p:first-child {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding-right: 52px;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__text {
    color: var(--text-secondary, #475569);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.custom-modal.snapshot-save-status-modal .custom-modal-buttons {
    justify-content: flex-end;
}

.custom-modal.snapshot-save-status-modal .btn-ok {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
}

@media (max-width: 640px) {
    .custom-modal.snapshot-save-status-modal {
        width: min(92vw, 560px);
        min-width: min(92vw, 420px);
    }

    .custom-modal.snapshot-save-status-modal .custom-modal-title {
        width: 96px;
        padding: 18px 14px;
    }

    .custom-modal.snapshot-save-status-modal .custom-modal-content {
        padding: 18px 18px 18px;
    }

    .custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__headline {
        font-size: 18px;
    }
}

.custom-modal.shortcuts-help-modal {
    width: min(1080px, 96vw);
    min-width: min(920px, 96vw);
    max-width: 96vw;
    max-height: min(88vh, 920px);
}

.custom-modal.shortcuts-help-modal .custom-modal-title {
    width: 88px;
    padding: 24px 14px;
    align-items: flex-start;
}

.custom-modal.shortcuts-help-modal .custom-modal-title img,
.custom-modal.shortcuts-help-modal .custom-modal-title svg {
    width: 52px;
    height: 52px;
}

.custom-modal.shortcuts-help-modal .custom-modal-content {
    min-width: 0;
    min-height: 0;
    padding: 22px 22px 18px;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button:hover {
    background: var(--accent-soft, #eff6ff);
    border-color: #cbd5e1;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button.is-active {
    background: var(--accent-soft, #eff6ff);
    border-color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button img,
.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button svg {
    width: 24px;
    height: 24px;
    max-width: none;
    max-height: none;
}

.custom-modal.shortcuts-help-modal .custom-modal-body.shortcuts-help-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__view {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__header {
    display: grid;
    gap: 8px;
    padding-right: 52px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__title {
    padding-right: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lead {
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__note {
    padding: 16px 18px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__sections {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section {
    display: grid;
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section--lifehacks {
    padding: 18px 20px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section-title {
    margin: 0;
    color: var(--accent-primary, #2563eb);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__combos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    align-content: flex-start;
    min-width: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__combo {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__plus,
.custom-modal.shortcuts-help-modal .shortcuts-help-modal__or {
    color: var(--text-muted, #64748b);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__key {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    white-space: nowrap;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item-title {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item-meta {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subsections {
    display: grid;
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subsection {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subtitle {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-text {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 10px;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-list--ordered {
    padding-left: 24px;
}

.custom-modal.shortcuts-help-modal .custom-modal-buttons.shortcuts-help-modal__footer {
    justify-content: flex-end;
}

@media (max-width: 960px) {
    .custom-modal.shortcuts-help-modal {
        width: min(96vw, 720px);
        min-width: 0;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .custom-modal.shortcuts-help-modal {
        flex-direction: column;
        max-height: min(92vh, 920px);
    }

    .custom-modal.shortcuts-help-modal .custom-modal-title {
        width: 100%;
        padding: 18px 20px 14px;
        justify-content: flex-start;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail {
        flex-direction: row;
        justify-content: flex-start;
    }

    .custom-modal.shortcuts-help-modal .custom-modal-content {
        padding: 18px 18px 16px;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__header {
        padding-right: 44px;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__item {
        grid-template-columns: 1fr;
    }
}

.custom-modal.container-delete-modal {
    width: min(560px, 92vw);
    min-width: min(420px, 92vw);
}

.custom-modal.container-delete-modal .custom-modal-title {
    width: 88px;
    padding: 22px 14px;
}

.custom-modal.container-delete-modal .custom-modal-title img,
.custom-modal.container-delete-modal .custom-modal-title svg {
    width: 52px;
    height: 52px;
}

.custom-modal.container-delete-modal .custom-modal-content {
    padding: 22px 22px 18px;
    gap: 16px;
}

.custom-modal.container-delete-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.container-delete-modal .custom-modal-body > p:first-child {
    padding-right: 52px;
    display: grid;
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
}

.container-delete-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.container-delete-modal__inside,
.container-delete-modal__note {
    display: block;
}

.container-delete-modal__inside {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
}

.container-delete-modal__note {
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.custom-modal.container-delete-modal .modal-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.container-delete-modal .modal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent-primary, #2563eb);
}

.custom-modal.container-delete-modal .custom-modal-buttons {
    margin-top: 4px;
}

@media (max-width: 640px) {
    .custom-modal.container-delete-modal {
        min-width: 0;
        width: min(92vw, 520px);
    }

    .custom-modal.container-delete-modal .custom-modal-title {
        width: 80px;
        padding: 18px 12px;
    }

    .custom-modal.container-delete-modal .custom-modal-content {
        padding: 18px 16px 16px;
    }

    .container-delete-modal__headline {
        font-size: 18px;
    }
}
.custom-modal.dice-faces-modal {
    width: min(1120px, 96vw);
    max-width: 96vw;
    padding: 0;
    border-radius: 22px;
    overflow: hidden;
    gap: 0;
}

.custom-modal.dice-faces-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid var(--border-default, #dbe5f0);
}

.custom-modal.dice-faces-modal .custom-modal-title img {
    width: 64px;
    height: 64px;
    max-width: none;
    max-height: none;
}

.custom-modal.dice-faces-modal .custom-modal-content {
    padding: 20px 20px 18px;
}

.custom-modal.dice-faces-modal .custom-modal-body {
    gap: 12px;
    max-height: min(76vh, 720px);
    overflow: auto;
    padding-right: 4px;
}

.dice-faces__head {
    display: grid;
    gap: 6px;
}

.dice-faces__title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.dice-faces__hint {
    font-size: 13px;
    color: #475569;
}

.dice-faces__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

.dice-faces__section-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 6px 0 8px;
}

.dice-faces__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 52vh;
    overflow: auto;
    padding-right: 4px;
}

.dice-faces__item {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    display: grid;
    grid-template-rows: 88px auto;
    transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.dice-faces__item:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.38);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.10);
}

.dice-faces__item.is-used {
    opacity: 0.55;
}

.dice-faces__item.is-picked {
    border-color: rgba(59, 130, 246, 0.95);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.dice-faces__thumb {
    background: #f1f5f9;
    display: grid;
    place-items: center;
    padding: 6px;
}

.dice-faces__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.dice-faces__thumb-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 800;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.12;
}

.dice-faces__meta {
    padding: 8px 10px 10px;
}

.dice-faces__meta-title {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.dice-faces__faces {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.dice-faces__slot {
    border: 1px dashed rgba(148, 163, 184, 0.9);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 120px;
    min-width: 120px;
}

.dice-faces__slot.is-hot {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.dice-faces__slot-head {
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    white-space: nowrap;
}
.dice-faces__slot-head > div {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dice-faces__slot-remove {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.75);
    background: #fff;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.dice-faces__slot-remove:hover {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.65);
}

.dice-faces__slot-remove:active {
    transform: translateY(1px);
}

.dice-faces__slot-body {
    padding: 8px;
    display: grid;
    place-items: center;
}

.dice-faces__slot-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    font-size: 12px;
    color: #64748b;
}

.dice-faces__slot-empty-text {
    max-width: 170px;
}

.dice-faces__builtin-face {
    --dice-size: 44px;
    --dice-dot-size: 7px;
    --dice-dot-inset: 10px;
    width: var(--dice-size);
    height: var(--dice-size);
    position: relative;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(2, 6, 23, 0.08);
    overflow: hidden;
}

.dice-faces__builtin-face .dot {
    position: absolute;
    width: var(--dice-dot-size);
    height: var(--dice-dot-size);
    background: #111;
    border-radius: 50%;
}
.dice-faces__builtin-face .top-left     { top: var(--dice-dot-inset); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .top-right    { top: var(--dice-dot-inset); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .mid-left     { top: calc(50% - (var(--dice-dot-size) / 2)); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .mid-right    { top: calc(50% - (var(--dice-dot-size) / 2)); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .bottom-left  { bottom: var(--dice-dot-inset); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .bottom-right { bottom: var(--dice-dot-inset); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .center       { top: calc(50% - (var(--dice-dot-size) / 2)); left: calc(50% - (var(--dice-dot-size) / 2)); }

.dice-faces__builtin-face--number .dice-face-builtin-number {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #0f172a;
    font-size: 20px;
    line-height: 1;
}

.dice-faces__inline-editor {
    width: 100%;
    height: 100%;
    min-height: 88px;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.dice-faces__slot-item {
    width: 100%;
    height: 100%;
    cursor: default;
    grid-template-rows: 1fr auto;
}

.dice-faces__slot-item .dice-faces__thumb {
    min-height: 64px;
}

.dice-faces__slot--add {
    cursor: pointer;
    border-style: solid;
    border-color: rgba(148, 163, 184, 0.55);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 1));
    min-height: 108px;
}

.dice-faces__slot--add .dice-faces__slot-head {
    justify-content: center;
    color: #334155;
}

.dice-faces__slot--add .dice-faces__slot-body {
    padding: 12px;
}

.dice-faces__slot-add-icon {
    width: 52px;
    height: 52px;
    opacity: 0.92;
    pointer-events: none;
    user-select: none;
    margin: 0 auto;
}

.dice-faces__controls {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dice-faces__size {
    display: grid;
    grid-template-columns: auto 1fr 84px;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.dice-faces__size span {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.dice-faces__size-range {
    width: 100%;
}

.dice-faces__size-number {
    width: 48px;
    text-align: right;
    padding: 6px 8px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    border-radius: 10px;
}

.dice-faces__clear {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.9);
    background: #ffffff;
    color: #0f172a;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.dice-faces__clear:hover {
    background: #f8fafc;
    border-color: rgba(100, 116, 139, 0.9);
}

.dice-faces__clear:active {
    transform: translateY(1px);
}

@media (max-width: 860px) {
    .dice-faces__grid {
        grid-template-columns: 1fr;
    }
    .dice-faces__list {
        max-height: 32vh;
    }
}
.custom-modal-body .modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.custom-modal-body .modal-checkbox input {
    width: auto;
    padding: 0;
}

.custom-modal-body .modal-radio-group{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 12px;
}

.custom-modal-body .modal-radio-group__label{
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 2px;
}

.custom-modal-body .modal-radio{
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    margin: 0;
    font-size: 14px;
}

.custom-modal-body .modal-radio input[type="radio"]{
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
}

/* ============================
   Memory Match settings modal
   ============================ */

.custom-modal.memory-settings-modal{
    width: min(720px, 92vw);
    max-width: 92vw;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.custom-modal.memory-settings-modal .custom-modal-title{
    max-width: none;
    width: 84px;
    padding: 18px 12px;
    align-items: flex-start;
    justify-content: center;
    background: linear-gradient(180deg, rgba(59,130,246,0.10), rgba(255,255,255,0));
    border-right: 1px solid rgba(15,23,42,0.08);
}

.custom-modal.memory-settings-modal .custom-modal-content{
    padding: 18px 18px 14px;
}

.custom-modal.memory-settings-modal .custom-modal-close{
    display: block;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 22px;
    line-height: 1;
    color: rgba(15, 23, 42, 0.7);
}
.custom-modal.memory-settings-modal .custom-modal-close:hover{
    background: rgba(15, 23, 42, 0.10);
    color: rgba(15, 23, 42, 0.9);
}

.memory-settings__head{
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 42px;
}
.memory-settings__title{
    font-size: 18px;
    font-weight: 800;
    color: #111827;
}
.memory-settings__sub{
    font-size: 12px;
    color: #6b7280;
}

.memory-settings__grid{
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.memory-settings__section{
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 14px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.75);
}
.memory-settings__section--full{
    grid-column: 1 / -1;
}
.memory-settings__section-title{
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 10px;
}
.memory-settings__fields{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.memory-settings__fields--cols{
    grid-template-columns: 1fr 1fr;
}
.memory-settings__field{
    display: grid;
    gap: 6px;
}
.memory-settings__field--full{
    grid-column: 1 / -1;
}
.memory-settings__field span{
    font-size: 12px;
    color: #374151;
    font-weight: 600;
}
.memory-settings__color-row{
    display: flex;
    align-items: center;
}
.memory-settings__color-btn{
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    cursor: pointer;
    padding: 0;
}
.memory-settings__hint{
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
    margin-top: 8px;
}
.memory-settings__modes{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.memory-settings__mode-btn{
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-default, rgba(15,23,42,0.10));
    background: #ffffff;
    color: var(--text-primary, #111827);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.memory-settings__mode-btn:hover{
    background: var(--accent-soft, #eef6ff);
    border-color: var(--border-strong, #cbd5e1);
}
.memory-settings__mode-btn.is-active{
    background: var(--accent-soft, #eef6ff);
    border-color: var(--accent-primary, #1d4ed8);
    color: var(--accent-primary, #1d4ed8);
}

.deck-settings{
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.deck-settings__section{
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 14px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.75);
}

.deck-settings__main-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.deck-settings__row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.deck-settings__row input[type="number"]{
    width: 104px;
}

.deck-settings__row--gap{
    margin-top: 12px;
}

.deck-settings__row--toggle{
    margin-top: 6px;
}

.deck-toggle-group{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.deck-settings__animation-header{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.deck-settings__animation-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.deck-settings__anim-group{
    display: grid;
    gap: 8px;
}

.deck-settings__anim-group > label{
    font-size: 12px;
    color: #374151;
    font-weight: 700;
}

.deck-settings__section--audio{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
}

.deck-settings__section--audio input[type="range"]{
    width: 100%;
}

.deck-toggle{
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.deck-toggle input[type="checkbox"]{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.deck-toggle__track{
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #e5e7eb;
    border: 1px solid #cfd4dd;
    position: relative;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.deck-toggle__thumb{
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    position: absolute;
    top: 2px;
    left: 2px;
    box-shadow: 0 2px 6px rgba(15,23,42,0.22);
    transition: left 0.16s ease, border-color 0.16s ease;
}

.deck-toggle input[type="checkbox"]:checked + .deck-toggle__track{
    background: #dbeafe;
    border-color: #93c5fd;
}

.deck-toggle input[type="checkbox"]:checked + .deck-toggle__track .deck-toggle__thumb{
    left: 22px;
    border-color: #93c5fd;
}

.deck-choice-group{
    display: grid;
    gap: 6px;
}

.deck-choice-group--4{
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.deck-choice-group--3{
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deck-choice-group--2{
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-choice{
    position: relative;
    display: block;
    user-select: none;
}

.deck-choice input[type="radio"]{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.deck-choice span{
    display: inline-flex;
    width: 100%;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.deck-choice input[type="radio"]:checked + span{
    background: #dbeafe;
    border-color: #60a5fa;
    color: #0f172a;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.18);
}

.custom-modal.memory-settings-modal .custom-modal-buttons{
    margin-top: 14px;
}

.custom-modal.formula-dialog-modal{
    width: min(720px, 92vw);
    max-width: 92vw;
}

.custom-modal.formula-dialog-modal .custom-modal-title{
    display: flex;
    align-items: center;
}

.formula-dialog-modal__titleCopy{
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.formula-dialog-modal__eyebrow{
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.formula-dialog-modal__headline{
    font-size: 18px;
    line-height: 1.2;
    color: #0f172a;
}

.formula-dialog-modal__body{
    display: grid;
    gap: 14px;
}

.formula-dialog-modal__field{
    display: grid;
    gap: 6px;
}

.formula-dialog-modal__textarea{
    min-height: 108px;
    resize: vertical;
}

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

.formula-dialog-modal__previewWrap{
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 16px;
    background: #f8fafc;
}

.formula-dialog-modal__previewLabel{
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.formula-dialog-modal__preview{
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
}

.formula-dialog-modal__preview--block{
    min-height: 88px;
}

.formula-dialog-modal__preview[data-preview-align="left"]{
    justify-content: flex-start;
}

.formula-dialog-modal__preview[data-preview-align="right"]{
    justify-content: flex-end;
}

.formula-dialog-modal__error{
    font-size: 12px;
    font-weight: 600;
    color: #b91c1c;
}

@media (max-width: 680px){
    .formula-dialog-modal__grid{
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px){
    .custom-modal.memory-settings-modal{
        flex-direction: column;
    }
    .custom-modal.memory-settings-modal .custom-modal-title{
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(15,23,42,0.08);
        padding: 14px 12px;
        align-items: center;
    }
    .memory-settings__grid{
        grid-template-columns: 1fr;
    }
    .deck-choice-group--4,
    .deck-choice-group--3,
    .deck-choice-group--2{
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px){
    .custom-modal.board-editor-modal{
        min-width: 0;
        width: min(96vw, 420px);
        flex-direction: column;
    }
    .custom-modal.board-editor-modal .custom-modal-title{
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        justify-content: flex-start;
        align-items: center;
    }
    .custom-modal.board-editor-modal .custom-modal-content{
        padding: 16px 16px 16px;
    }
    .custom-modal.board-editor-modal .custom-modal-buttons button{
        width: 100%;
    }
}

@media (max-width: 900px){
    .deck-settings__main-grid{
        grid-template-columns: 1fr;
    }
    .deck-settings__animation-grid{
        grid-template-columns: 1fr;
    }
    .deck-settings__section--audio{
        grid-template-columns: 1fr;
    }
}

.custom-modal-close {
    position: absolute; 
    top: -5px; 
    right: -5px;
    display: none;
    background: none; border: none; font-size: 26px;
    cursor: pointer; color: #777;
}
.custom-modal-close:hover { color: #000; }

.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    gap: 8px;
}
.custom-modal-buttons button {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-ok {
    background: #4caf50;
    color: white;
}
.btn-ok:hover { background: #45a049; }
.btn-cancel {
    background: #e0e0e0;
    color: #333;
}
.btn-cancel:hover { background: #d5d5d5; }

.custom-modal.homework-due-date-modal {
    width: min(480px, calc(100vw - 32px));
    min-width: min(480px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    align-items: stretch;
    font-family: var(--app-theme-font-family, inherit);
}

.custom-modal.homework-due-date-modal .custom-modal-title {
    width: 76px;
    max-width: 76px;
    padding: 0 12px;
    align-items: center;
}

.custom-modal.homework-due-date-modal .custom-modal-title img {
    width: 64px;
    height: 64px;
}

.custom-modal.homework-due-date-modal .custom-modal-content {
    min-width: 0;
}

.custom-modal.homework-due-date-modal .custom-modal-body {
    gap: 14px;
}

.custom-modal.homework-due-date-modal .modal-field {
    display: grid;
    gap: 6px;
}

.custom-modal.homework-due-date-modal .modal-field__label {
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 500;
    line-height: 1.25;
}

.custom-modal.homework-due-date-modal .homework-due-date-modal__picker {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-sm, 10px);
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    cursor: pointer;
}

.custom-modal.homework-due-date-modal .homework-due-date-modal__picker:hover,
.custom-modal.homework-due-date-modal .homework-due-date-modal__picker:focus-visible {
    border-color: var(--accent-primary, #3b82f6);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #3b82f6) 14%, transparent);
    outline: none;
}

.custom-modal.homework-due-date-modal .homework-due-date-modal__picker .modalInput {
    height: auto;
    min-height: 0;
    flex: 1;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.custom-modal.homework-due-date-modal .homework-due-date-modal__picker .modalInput:focus {
    outline: none;
}

.homework-due-date-modal__picker-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

:root.app-theme .custom-modal-overlay {
    background: color-mix(in srgb, var(--text-primary, #0f172a) 46%, transparent);
}

:root.app-theme .custom-modal {
    background: var(--bg-panel, #ffffff);
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-md, 14px);
    box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal h3 {
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-title, 20px);
}

:root.app-theme .custom-modal.error h3 {
    color: #b91c1c;
}

:root.app-theme .custom-modal-title {
    color: var(--text-primary, #0f172a);
}

:root.app-theme .custom-modal-content,
:root.app-theme .custom-modal-body {
    color: var(--text-primary, #0f172a);
}

:root.app-theme .custom-modal-body p {
    color: var(--text-secondary, #64748b);
    font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal-close {
    color: var(--text-secondary, #64748b);
    font-family: var(--app-theme-font-family, inherit);
}

:root.app-theme .custom-modal-close:hover,
:root.app-theme .custom-modal-close:focus-visible {
    color: var(--text-primary, #0f172a);
}

:root.app-theme .custom-modal-body input.modalInput:not([type="checkbox"]),
:root.app-theme .custom-modal-body textarea.modalInput,
:root.app-theme .custom-modal-body select.modalInput {
    background: var(--bg-panel, #ffffff);
    border-color: var(--border-default, #dbe5f0);
    border-radius: var(--radius-sm, 10px);
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal-body input.modalInput:not([type="checkbox"]):focus,
:root.app-theme .custom-modal-body textarea.modalInput:focus,
:root.app-theme .custom-modal-body select.modalInput:focus {
    outline: none;
    border-color: var(--accent-primary, #e66a2c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 18%, transparent);
}

:root.app-theme .custom-modal-buttons button {
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-sm, 10px);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-md, 15px);
    font-weight: 700;
}

:root.app-theme .custom-modal-buttons .btn-ok,
:root.app-theme .custom-modal .btn-ok {
    background: var(--accent-primary, #e66a2c);
    border-color: var(--accent-primary, #e66a2c);
    color: var(--text-on-accent, #ffffff);
}

:root.app-theme .custom-modal-buttons .btn-ok:hover,
:root.app-theme .custom-modal .btn-ok:hover,
:root.app-theme .custom-modal-buttons .btn-ok:focus-visible,
:root.app-theme .custom-modal .btn-ok:focus-visible {
    background: var(--accent-primary-hover, #c9561f);
    border-color: var(--accent-primary-hover, #c9561f);
}

:root.app-theme .custom-modal-buttons .btn-cancel,
:root.app-theme .custom-modal .btn-cancel {
    background: var(--bg-muted, #f8fafc);
    border-color: var(--border-default, #dbe5f0);
    color: var(--text-primary, #0f172a);
}

:root.app-theme .custom-modal-buttons .btn-cancel:hover,
:root.app-theme .custom-modal .btn-cancel:hover,
:root.app-theme .custom-modal-buttons .btn-cancel:focus-visible,
:root.app-theme .custom-modal .btn-cancel:focus-visible {
    background: var(--accent-soft, #fdece0);
    border-color: var(--accent-primary, #e66a2c);
}

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

/* ===== Sets export modal ===== */
.custom-modal.sets-export-modal {
    width: min(520px, 92vw);
}
.custom-modal.sets-export-modal .menu-title {
    font-weight: 700;
    font-size: 16px;
}
.custom-modal.sets-export-modal .menu-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 14px;
}
.custom-modal.sets-export-modal .menu-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #111;
}
.custom-modal.sets-export-modal .menu-field input[type="number"],
.custom-modal.sets-export-modal .menu-field select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 8px;
    width: 160px;
}
.custom-modal.sets-export-modal .menu-field.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.custom-modal.sets-export-modal .menu-field.checkbox input {
    width: 16px;
    height: 16px;
}

.text-settings__title {
    font-size: 18px;
    font-weight: 700;
}
.text-settings__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: end;
}
.text-settings__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.text-settings__field--full {
    grid-column: 1 / -1;
}
.text-settings__label {
    font-size: 13px;
    color: #444;
}
.text-settings__sep {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}
.text-settings__note {
    font-size: 12px;
    color: #666;
    background: #f7f7f7;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 8px 10px;
}

.custom-modal.text-settings-modal {
    width: min(1200px, 96vw);
    min-width: min(900px, 96vw);
    max-width: 96vw;
    max-height: min(88vh, 920px);
    padding: 0;
    gap: 0;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
}

.custom-modal.text-settings-modal .custom-modal-content {
    min-width: 0;
    min-height: 0;
    padding: 0;
    position: relative;
    overflow: visible;
}

.custom-modal.text-settings-modal .custom-modal-body {
    min-height: 0;
    gap: 0;
    overflow: visible;
}

.custom-modal.text-settings-modal .text-settings__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.custom-modal.text-settings-modal .text-settings__close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.text-settings-modal .text-settings__close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .text-settings__close:hover img,
.custom-modal.text-settings-modal .text-settings__close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.text-settings-modal .text-settings__close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.text-settings-modal .text-settings__header {
    padding: 16px 16px 12px;
    padding-right: 72px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.custom-modal.text-settings-modal .text-settings__headMain {
    display: grid;
    gap: 14px;
}

.custom-modal.text-settings-modal .text-settings__titleRow {
    display: flex;
    align-items: center;
    gap: 14px;
}

.custom-modal.text-settings-modal .text-settings__titleIcon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
}

.custom-modal.text-settings-modal .text-settings__titleIcon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .text-settings__title {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.custom-modal.text-settings-modal .text-settings__previewBlock {
    display: grid;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__previewTitle {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.text-settings-modal .text-settings__preview-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__preview {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.text-settings-modal .text-settings__preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.custom-modal.text-settings-modal .text-settings__note {
    margin: 16px 24px 0;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
    color: var(--text-secondary, #475569);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.text-settings-modal .text-settings__toolbar {
    padding: 8px 12px 0;
}

.custom-modal.text-settings-modal .text-inline-toolbar__surface.text-settings__toolbarSurface {
    width: 100%;
    min-height: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 4px 12px 6px;
    box-shadow: none;
    border-radius: 14px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__sectionLabel {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__sectionBody {
    min-height: 40px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__section--style {
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__section--display {
    margin-left: auto;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__richToolbar {
    margin-bottom: 0;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__richToolbarGroup {
    flex-wrap: nowrap;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__font-picker--toolbar {
    width: min(280px, 100%);
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__font-size--toolbar {
    min-width: 124px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__colorRow--toolbar {
    display: inline-flex;
    align-items: center;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__color-btn--toolbar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.custom-modal.text-settings-modal .text-settings__toolbarDisplayGroup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__richAction--toolbar {
    min-width: 40px;
    width: 40px;
    height: 40px;
}

.custom-modal.text-settings-modal .text-settings__richMathGlyph {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.custom-modal.text-settings-modal .text-settings__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 16px 24px 24px;
    overflow: auto;
    min-height: 0;
}

.custom-modal.text-settings-modal .text-settings__layoutMain {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__footerControls {
    padding: 0 12px 8px;
    overflow: visible;
}

.custom-modal.text-settings-modal .text-inline-toolbar__surface.text-settings__footerControlsSurface {
    width: max-content;
    min-width: 100%;
    min-height: 56px;
    height: 56px;
    padding: 6px 12px 6px;
    box-sizing: border-box;
    box-shadow: none;
    border-radius: 14px;
    align-items: center;
}

.custom-modal.text-settings-modal .text-settings__footerControlsSection .text-inline-toolbar__sectionLabel {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__footerControlsSection .text-inline-toolbar__sectionBody {
    min-height: 40px;
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidthMenu,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyleMenu,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameRadiusMenu {
    top: auto;
    bottom: calc(100% + 10px);
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidthTrigger::after,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyleTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidth.is-open .text-inline-toolbar__frameWidthTrigger::after,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyle.is-open .text-inline-toolbar__frameStyleTrigger::after {
    transform: translateY(-60%) rotate(45deg);
}

.custom-modal.text-settings-modal .text-settings__panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.94), rgba(255, 255, 255, 0.98));
}

.custom-modal.text-settings-modal .text-settings__panelTitle {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.text-settings-modal .text-settings__panelGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.custom-modal.text-settings-modal .text-settings__field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__field--full {
    grid-column: 1 / -1;
}

.custom-modal.text-settings-modal .text-settings__field--textarea {
    height: 100%;
}

.custom-modal.text-settings-modal .text-settings__label {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__label--icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__label--icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .modalInput {
    box-sizing: border-box;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-modal.text-settings-modal .modalInput:hover {
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .modalInput:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal select.modalInput {
    min-height: 46px;
    padding: 0 14px;
}

.custom-modal.text-settings-modal .text-settings__textarea {
    width: 100%;
    min-height: 420px;
    height: 100%;
    max-height: min(62vh, 640px);
    padding: 16px 18px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.5;
}

.custom-modal.text-settings-modal .text-settings__textarea--mirror[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__richToolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.custom-modal.text-settings-modal .text-settings__richToolbarGroup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__richUnderlinePicker {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__richAction {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 12px;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph] {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none !important;
    text-underline-offset: 0;
    text-decoration-thickness: auto;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 16px;
    height: 0;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: translateX(-50%);
}

.custom-modal.text-settings-modal [data-rich-underline-glyph].is-underline {
    text-decoration: none !important;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph].is-underline::after {
    height: 2px;
    opacity: 1;
}

.custom-modal.text-settings-modal .text-settings__richAction--menu {
    min-width: 32px;
    width: 32px;
    padding: 0;
}

.custom-modal.text-settings-modal .text-settings__richAction--menu img {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0 auto;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineMenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineMenu[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption {
    width: 64px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption:hover,
.custom-modal.text-settings-modal .text-settings__richUnderlineOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption img {
    width: 48px;
    height: 48px;
    display: block;
}

.custom-modal.text-settings-modal .text-settings__richEditor {
    width: 100%;
    min-height: 372px;
    height: 100%;
    max-height: min(62vh, 640px);
    overflow: auto;
    padding: 12px 14px;
    caret-color: currentColor;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment {
    display: inline;
    line-height: inherit;
    white-space: pre-wrap;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-tab {
    display: inline-block;
    width: 4ch;
    min-width: 4ch;
    white-space: pre;
    vertical-align: baseline;
    overflow: hidden;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-solid[data-underline-style="solid"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(to right, currentColor 0 100%);
    background-size: 100% 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: no-repeat;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-dashed[data-underline-style="dashed"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(to right, currentColor 0 12px, transparent 12px 18px);
    background-size: 18px 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: repeat-x;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-dash-dot[data-underline-style="dash-dot"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(
      to right,
      currentColor 0 10px,
      transparent 10px 14px,
      currentColor 14px 16px,
      transparent 16px 24px
    );
    background-size: 24px 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: repeat-x;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-modal.text-settings-modal .text-settings__color-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__color-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.custom-modal.text-settings-modal .text-settings__color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.custom-modal.text-settings-modal .text-settings__font-picker {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__font-picker .text-inline-toolbar__fontTrigger {
    min-height: 44px;
}

.custom-modal.text-settings-modal .text-settings__font-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 12;
}

.custom-modal.text-settings-modal .text-settings__font-menu[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__font-option {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
}

.custom-modal.text-settings-modal .text-settings__font-option:hover,
.custom-modal.text-settings-modal .text-settings__font-option.is-selected {
    background: #f8fafc;
}

.custom-modal.text-settings-modal .text-settings__font-option.is-selected {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.custom-modal.text-settings-modal .text-settings__font-option-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.custom-modal.text-settings-modal .text-settings__font-option-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    line-height: 1.2;
    white-space: nowrap;
}

.custom-modal.text-settings-modal .text-settings__font-size {
    display: grid;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__size-picker .text-inline-toolbar__sizeTrigger {
    min-height: 44px;
}

.custom-modal.text-settings-modal .text-settings__choiceGroup {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__inlineTools {
    display: grid;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsBody {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsBody .text-settings__choiceGroup {
    flex: 1 1 auto;
}

.custom-modal.text-settings-modal .text-settings__inlineColor {
    flex: 0 0 auto;
}

.custom-modal.text-settings-modal .text-settings__inlineColorLabel {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.text-settings-modal .text-settings__choiceButton {
    min-height: 40px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__choiceButton--icon {
    width: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.text-settings-modal .text-settings__choiceButton--text {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.text-settings-modal .text-settings__choiceButton:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.text-settings-modal .text-settings__choiceButton:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    background: #f8fafc;
    transform: none;
}

.custom-modal.text-settings-modal .text-settings__choiceButton.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__choiceButton:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__choiceIcon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .text-settings__choiceText {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.custom-modal.text-settings-modal .text-settings__switchList {
    display: grid;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__frameGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.7), rgba(255, 255, 255, 0.96));
}

.custom-modal.text-settings-modal .text-settings__numberInputWrap {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__numberInput {
    padding-right: 42px !important;
}

.custom-modal.text-settings-modal .text-settings__numberSuffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.custom-modal.text-settings-modal .text-settings__switchRow {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}

.custom-modal.text-settings-modal .text-settings__switchRowMain {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__switchRow--color {
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__switchRow--color .text-settings__switchRowMain {
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__switchLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.custom-modal.text-settings-modal .text-settings__switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}

.custom-modal.text-settings-modal .text-settings__switchInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.custom-modal.text-settings-modal .text-settings__switchTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__switchTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__switchInput:hover + .text-settings__switchTrack {
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .text-settings__switchInput:focus-visible + .text-settings__switchTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}

.custom-modal.text-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack::after {
    transform: translateX(18px);
}

.custom-modal.text-settings-modal .text-settings__switchInput:disabled + .text-settings__switchTrack {
    opacity: 0.55;
}

.custom-modal.text-settings-modal .custom-modal-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 0;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
}

.custom-modal.text-settings-modal .text-settings__footerLeft,
.custom-modal.text-settings-modal .text-settings__footerRight {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-modal.text-settings-modal .text-settings__footerLeft {
    margin-left: auto;
}

.custom-modal.text-settings-modal .text-settings__footerRight {
    margin-left: 0;
}

.custom-modal.text-settings-modal .custom-modal-buttons button {
    min-width: 120px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
}

.custom-modal.text-settings-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.text-settings-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.text-settings-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 960px) {
    .custom-modal.text-settings-modal {
        min-width: 0;
        width: min(96vw, 860px);
    }

    .custom-modal.text-settings-modal .text-settings__layout {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__textarea {
        min-height: 260px;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .custom-modal.text-settings-modal .text-settings__header {
        padding: 20px 16px 14px;
        padding-right: 60px;
    }

    .custom-modal.text-settings-modal .text-settings__toolbar {
        padding: 14px 16px 0;
    }

    .custom-modal.text-settings-modal .text-settings__footerControls {
        padding: 0 16px 16px;
    }

    .custom-modal.text-settings-modal .text-settings__note {
        margin: 14px 16px 0;
    }

    .custom-modal.text-settings-modal .text-settings__layout {
        padding: 16px 16px 18px;
        gap: 16px;
    }

    .custom-modal.text-settings-modal .text-settings__panelGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__inlineTools {
        gap: 10px;
    }

    .custom-modal.text-settings-modal .text-settings__inlineToolsHead,
    .custom-modal.text-settings-modal .text-settings__inlineToolsBody {
        align-items: stretch;
    }

    .custom-modal.text-settings-modal .text-settings__inlineColor {
        width: 100%;
    }

    .custom-modal.text-settings-modal .text-settings__switchRow--color {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__frameGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-inline-toolbar__sizeMenu {
        left: 0;
        min-width: 0;
    }

    .custom-modal.text-settings-modal .custom-modal-buttons {
        padding: 14px 16px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal.text-settings-modal .text-settings__footerLeft,
    .custom-modal.text-settings-modal .text-settings__footerRight {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
    }

    .custom-modal.text-settings-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.text-edit-modal {
    max-width: 90vw;
}
.custom-modal.text-edit-modal textarea.modalInput {
    resize: both;
    min-height: 140px;
    width: 420px;
    max-width: 86vw;
}

.custom-modal.contacts-modal {
  max-width: min(720px, 92vw);
}

.custom-modal.contacts-modal .custom-modal-body p {
  font-size: 14px;
  line-height: 1.55;
}

/* --- Donation modal (global) --- */
.donation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2147483647;
}

.donation-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(580px, 92vw);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.92));
  backdrop-filter: blur(18px);
  border-radius: 16px;
  border: 1px solid rgba(214, 225, 240, 0.85);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.donation-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border-bottom: 1px solid rgba(230, 234, 242, 0.8);
  cursor: grab;
  user-select: none;
}

.donation-title {
  font-weight: 800;
  font-size: 20px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.donation-title__icon {
  width: 48px;
  height: 48px;
  display: block;
}

.donation-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #eef2f7;
  cursor: pointer;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.donation-close img {
  width: 20px;
  height: 20px;
  display: block;
}

.donation-close:hover {
  background: #d7e0eb;
  border-color: #bfcada;
  transform: rotate(180deg);
}

.donation-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.donation-desc {
  color: #5f6b7a;
  font-size: 14px;
  line-height: 1.4;
}

.donation-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donation-label {
  font-weight: 700;
  color: #111;
  font-size: 13px;
}

.donation-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.donation-amount {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d9e2ef;
  background: linear-gradient(180deg, #fdfefe, #edf3fb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -4px 12px rgba(191, 205, 224, 0.22);
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
}

.donation-amount:hover {
  background: linear-gradient(180deg, #ffffff, #e7effa);
}

.donation-amount.active {
  border-color: #6c8cff;
  background: linear-gradient(180deg, #f2f6ff, #dee8ff);
  color: #3053bf;
  font-size: larger;
}

.donation-other {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  align-items: center;
}

.donation-other input {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d9e2ef;
  padding: 0 12px;
  font-size: larger;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -4px 12px rgba(191, 205, 224, 0.18);
}

.donation-other input:disabled {
  background: #f9fafc;
  color: #94a3b8;
}

.donation-payments {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  align-items: center;
  justify-content: space-evenly;
  padding-top: 4px;
}

.donation-payments img {
  height: 32px;
  opacity: 0.6;
  filter: grayscale(30%);
  user-select: none;
}

.donation-legal {
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.35;
  border-top: 1px dashed #e6eaf2;
  padding-top: 10px;
  margin-top: 12px;
}

.donation-actions {
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  justify-content: space-evenly;
  align-items: center;
  border-top: 1px solid rgba(230, 234, 242, 0.8);
  background: transparent;
}

.donation-provider {
  height: 32px;
}

.donation-action-btn {
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.donation-action-btn.donation-cancel {
  background: transparent;
  border: 1px solid #d3d9e6;
  color: #334155;
}

.donation-action-btn.donation-cancel:hover {
  background: #f8fafc;
}

.donation-action-btn.donation-support {
  border: 0;
  background: linear-gradient(135deg, #6c8cff, #4c6ef5);
  color: #fff;
  box-shadow: 0 10px 22px rgba(76, 110, 245, 0.25);
  min-width: 168px;
  height: 48px;
}

.donation-action-btn.donation-support:hover {
  filter: brightness(1.03);
}

.donation-action-btn.donation-support:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

:root.app-theme .donation-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 45%, transparent);
}

:root.app-theme .donation-modal {
  background: color-mix(in srgb, var(--bg-panel, #fff) 94%, var(--bg-app, #f8fafc));
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .donation-header,
:root.app-theme .donation-actions {
  border-color: var(--border-default, #dbe5f0);
  background: color-mix(in srgb, var(--bg-panel, #fff) 82%, transparent);
}

:root.app-theme .donation-title,
:root.app-theme .donation-label,
:root.app-theme .donation-amount,
:root.app-theme .donation-other input {
  color: var(--text-primary, #0f172a);
}

:root.app-theme .donation-close,
:root.app-theme .donation-amount,
:root.app-theme .donation-other input,
:root.app-theme .donation-action-btn {
  font-family: var(--app-theme-font-family, inherit);
}

:root.app-theme .donation-title {
  font-size: var(--app-theme-font-size-title, 20px);
}

:root.app-theme .donation-desc,
:root.app-theme .donation-legal {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .donation-desc,
:root.app-theme .donation-action-btn {
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .donation-amount,
:root.app-theme .donation-other input {
  font-size: var(--app-theme-font-size-md, 15px);
  line-height: 1.15;
}

:root.app-theme .donation-label,
:root.app-theme .donation-legal {
  font-size: var(--app-theme-font-size-sm, 14px);
}

:root.app-theme .donation-close {
  position: relative;
  color: var(--text-primary, #0f172a);
}

:root.app-theme .donation-close img {
  opacity: 0;
}

:root.app-theme .donation-close::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("/static/assets/icons/delete.svg") center / contain no-repeat;
  mask: url("/static/assets/icons/delete.svg") center / contain no-repeat;
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

:root.app-theme .donation-close,
:root.app-theme .donation-amount,
:root.app-theme .donation-other input,
:root.app-theme .donation-action-btn.donation-cancel {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .donation-close:hover,
:root.app-theme .donation-amount:hover,
:root.app-theme .donation-action-btn.donation-cancel:hover {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
}

:root.app-theme .donation-close:hover {
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .donation-action-btn.donation-cancel:hover {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-strong, #cbd5e1);
}

:root.app-theme .donation-amount.active {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
  font-size: var(--app-theme-font-size-lg, 17px);
}

:root.app-theme .donation-other input:focus {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 18%, transparent);
}

:root.app-theme .donation-other input:disabled {
  background: var(--bg-muted, #f8fafc);
  color: var(--text-muted, #94a3b8);
}

:root.app-theme .donation-action-btn.donation-cancel {
  color: var(--text-primary, #0f172a);
}

:root.app-theme .donation-action-btn.donation-support {
  background: var(--accent-primary, #e66a2c);
  border: 1px solid var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #fff);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent-primary, #e66a2c) 25%, transparent);
}

:root.app-theme .donation-action-btn.donation-support:hover {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
  filter: none;
}

/* --- Feedback modal (global) --- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2048;
}

.feedback-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 92vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feedback-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e6e9ef;
  background: #f8fafc;
  user-select: none;
  cursor: grab;
}

body.feedback-dragging .feedback-header {
  cursor: grabbing;
}

.feedback-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  color: #111;
}

.feedback-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.feedback-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #eef2f7;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.feedback-close img {
  width: 20px;
  height: 20px;
  display: block;
}

.feedback-close:hover {
  background: #d7e0eb;
  border-color: #bfcada;
  transform: rotate(180deg);
}

.feedback-body {
  padding: 12px 14px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.feedback-label .req {
  color: #dc2626;
}

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 360px;
  box-sizing: border-box;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

.feedback-textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.feedback-drop {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-drop.dragover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.feedback-drop-hint {
  font-size: 13px;
  color: #475569;
}

.feedback-upload-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.feedback-upload-btn:hover,
.feedback-upload-btn:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.feedback-upload-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.feedback-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fb-thumb {
  width: 86px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.fb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.fb-thumb-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  line-height: 1;
}

.feedback-actions {
  padding: 12px 18px;
  border-top: 1px solid #e6e9ef;
  background: #f8fafc;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-actions-left {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  min-width: 0;
}

.feedback-action-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.feedback-action-icon:hover,
.feedback-action-icon:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.feedback-action-icon:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.feedback-action-icon img {
  width: 22px;
  height: 22px;
  display: block;
}

.feedback-action-note {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-action {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid #d7e3ff;
  cursor: pointer;
}

.feedback-action--primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.feedback-action--secondary {
  background: #eef2f7;
  color: #334155;
  border-color: #cbd5e1;
}

.feedback-action--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feedback-action.loading {
  opacity: 0.85;
  pointer-events: none;
}

.feedback-view .fb-view-message {
  white-space: pre-wrap;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  line-height: 1.4;
  color: #0f172a;
}

.fb-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.fb-thread-msg {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.fb-thread-msg.admin {
  background: #f6fbff;
  border-color: #d9ecff;
}

.fb-thread-author {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

:root.app-theme .feedback-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 45%, transparent);
}

:root.app-theme .feedback-modal {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 20%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .feedback-header,
:root.app-theme .feedback-actions {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .feedback-title,
:root.app-theme .feedback-label,
:root.app-theme .feedback-action-note,
:root.app-theme .feedback-view .fb-view-message,
:root.app-theme .fb-thread-author {
  color: var(--text-primary, #0f172a);
}

:root.app-theme .feedback-title {
  font-size: var(--app-theme-font-size-title, 20px);
}

:root.app-theme .feedback-label,
:root.app-theme .feedback-drop-hint,
:root.app-theme .feedback-action,
:root.app-theme .feedback-action-note,
:root.app-theme .feedback-view .fb-view-message {
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .fb-thread-author {
  font-size: var(--app-theme-font-size-sm, 14px);
}

:root.app-theme .feedback-drop-hint {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .feedback-close,
:root.app-theme .feedback-upload-btn,
:root.app-theme .feedback-action-icon,
:root.app-theme .feedback-action--secondary,
:root.app-theme .feedback-view .fb-view-message,
:root.app-theme .fb-thread-msg,
:root.app-theme .fb-thumb,
:root.app-theme .fb-thumb img {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .feedback-close:hover,
:root.app-theme .feedback-upload-btn:hover,
:root.app-theme .feedback-upload-btn:focus-visible,
:root.app-theme .feedback-action-icon:hover,
:root.app-theme .feedback-action-icon:focus-visible,
:root.app-theme .feedback-action--secondary:hover {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 12%, transparent);
}

:root.app-theme .feedback-textarea {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .feedback-textarea:focus {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 18%, transparent);
}

:root.app-theme .feedback-drop {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .feedback-drop.dragover,
:root.app-theme .fb-thread-msg.admin {
  background: var(--accent-soft, #fdece0);
  border-color: color-mix(in srgb, var(--accent-primary, #e66a2c) 30%, var(--border-default, #dbe5f0));
}

:root.app-theme .feedback-action--primary {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #fff);
}

:root.app-theme .feedback-action--primary:hover,
:root.app-theme .feedback-action--primary:focus-visible {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
}

/* --- Student modal (dashboard v2) --- */
.student-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.student-modal {
  background: #fff;
  width: min(540px, 94vw);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.student-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e6e9ef;
  background: #f8fafc;
}

.student-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.student-modal__body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  overflow: auto;
}

.student-modal__avatar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: stretch;
}

.student-avatar-drop {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  height: 100%;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.student-avatar-drop.dragover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.student-avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
  margin: 4px auto 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.student-avatar-fallback {
  font-weight: 800;
  font-size: 32px;
  color: #64748b;
}

.student-avatar-text {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  margin-bottom: 10px;
}

.student-avatar-sub {
  font-size: 12px;
  color: #64748b;
}

.student-avatar-error {
  font-size: 12px;
  color: #b91c1c;
}

.student-modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  justify-self: stretch;
  width: 100%;
}

.student-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.student-modal__label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.student-modal__input {
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  font-family: inherit;
}

.student-modal__input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.student-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #e6e9ef;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.student-modal__error {
  color: #b91c1c;
  font-size: 13px;
}

.student-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.student-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  color: #1f2937;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.student-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.student-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.student-modal__actions .btn.primary:hover {
  background: #1d4ed8;
}

@media (max-width: 720px) {
  .student-modal__body {
    grid-template-columns: 1fr;
  }
}

.class-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 10000;
  padding: 56px 16px 24px;
  overflow-y: auto;
}

.class-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 80px);
  border-radius: 12px;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.class-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #dbe5f0;
  background: #f8fafc;
}

.class-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 10px;
}

.class-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.student-modal__close,
.class-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #dbe5f0;
  background: #fff;
  cursor: pointer;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.student-modal__close img,
.class-modal__close img {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 0.18s ease;
}

.student-modal__close:hover,
.class-modal__close:hover {
  background: #eef2f7;
}

.student-modal__close:hover img,
.student-modal__close:focus-visible img,
.class-modal__close:hover img,
.class-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.student-modal__close:focus-visible,
.class-modal__close:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.2);
  outline-offset: 2px;
}

.class-modal__body {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}

.class-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.class-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.class-modal__field--full {
  grid-column: 1 / -1;
}

.class-modal__label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.class-modal__input,
.class-modal__textarea,
.class-modal__select,
.class-modal .students-topbar-search__input {
  height: 40px;
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  box-shadow: none;
}

.class-modal__textarea-wrap {
  position: relative;
  display: flex;
}

.class-modal__textarea {
  min-height: 132px;
  resize: none;
  padding-bottom: 24px;
}

.class-modal__resize-handle {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 40px;
  height: 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: ns-resize;
  padding: 0;
  touch-action: none;
  opacity: 0.72;
}

.class-modal__resize-handle::before,
.class-modal__resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.32);
  transform: translateX(-50%);
}

.class-modal__resize-handle::before {
  top: calc(50% - 3px);
}

.class-modal__resize-handle::after {
  top: calc(50% + 3px);
}

.class-modal__resize-handle:hover {
  opacity: 1;
}

.class-modal__resize-handle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
  opacity: 1;
}

body.class-modal-resizing {
  user-select: none;
}

.class-modal__input:focus,
.class-modal__textarea:focus,
.class-modal__select:focus,
.class-modal .students-topbar-search__input:focus,
.class-modal .students-topbar-search__input:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.class-modal__section {
  border: 1px solid #dbe5f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.class-modal__section-head {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 1;
}

.class-modal__section-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}

.class-modal__section-summary {
  min-width: 0;
  max-width: 100%;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-modal__section-search {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.class-modal__section-chevron {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.class-modal__section-chevron img {
  width: 20px;
  height: 20px;
  display: block;
}

.class-modal__section.is-open .class-modal__section-chevron {
  transform: rotate(180deg);
}

.class-modal__section-body {
  display: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  max-height: 340px;
  padding: 0 14px 14px;
  border-top: 1px solid #edf2f7;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.class-modal__section-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.class-modal__section.is-open .class-modal__section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.class-modal .students-topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.class-modal .students-topbar-search__field {
  width: 0;
  max-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: max-width 0.2s ease, opacity 0.18s ease, visibility 0.18s ease;
}

.class-modal .students-topbar-search__field.is-open {
  width: min(280px, 42vw);
  max-width: min(280px, 42vw);
  opacity: 1;
  border-radius: 10px;
  visibility: visible;
  pointer-events: auto;
}

.class-modal .students-topbar-search__toggle {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #dbe2ee;
  border-radius: 10px;
  background: #fff;
}

.class-modal .students-topbar-search__toggle.is-active,
.class-modal .students-topbar-search__toggle:hover,
.class-modal .students-topbar-search__toggle:focus-visible {
  background: #eff4ff;
  border-color: #b2ddff;
}

.class-modal .students-topbar-search__toggle img {
  width: 24px;
  height: 24px;
  display: block;
}

.class-modal__members-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  align-content: start;
}

.class-modal__member {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbe2ee;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.class-modal__member:hover {
  border-color: #b2ddff;
  background: #f8fbff;
}

.class-modal__member.is-active {
  border-color: #b2ddff;
  background: #eff4ff;
}

.class-modal__member input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 auto;
}

.class-modal__member-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.class-modal__member-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.class-modal__member-meta {
  font-size: 12px;
  color: #64748b;
  word-break: break-word;
}

.class-modal__members-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.class-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #dbe5f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.class-modal__footer-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.class-modal__paint-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.class-modal__color-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  padding: 12px;
  border: 1px solid #d6dbe3;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
  z-index: 8;
}

.class-modal__color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.class-modal__color-option {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.class-modal__color-check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  display: block;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
  transition: opacity 0.12s ease;
}

.class-modal__color-option:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.36);
}

.class-modal__color-option.is-selected {
  border-color: #111827;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.14);
}

.class-modal__color-option.is-selected .class-modal__color-check {
  opacity: 1;
}

.class-modal__paint-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.class-modal__paint-btn img {
  width: 24px;
  height: 24px;
  display: block;
}

.class-modal__paint-btn.is-active {
  border-color: var(--class-modal-picked-color, #94a3b8);
  box-shadow: 0 10px 22px rgba(100, 116, 139, 0.18);
}

.class-modal__paint-swatch {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--class-modal-picked-color, transparent);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.class-modal__paint-btn.is-active .class-modal__paint-swatch {
  opacity: 1;
}

.class-modal__color-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.class-modal__error {
  color: #b91c1c;
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 0;
}

.class-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.class-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  color: #1f2937;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.class-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.class-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.class-modal__actions .btn.primary:hover {
  background: #1d4ed8;
}

:root.app-theme .class-modal-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 45%, transparent);
}

:root.app-theme .class-modal {
  background: var(--bg-app, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .class-modal__header,
:root.app-theme .class-modal__footer {
  background: var(--bg-app, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .class-modal__title,
:root.app-theme .class-modal__section-title,
:root.app-theme .class-modal__member-name {
  color: var(--text-primary, #0f172a);
}

:root.app-theme .class-modal__title {
  font-size: var(--app-theme-font-size-title, 20px);
}

:root.app-theme .class-modal__label,
:root.app-theme .class-modal__section-summary,
:root.app-theme .class-modal__member-meta,
:root.app-theme .class-modal__members-empty {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .class-modal__label,
:root.app-theme .class-modal__section-summary,
:root.app-theme .class-modal__members-empty,
:root.app-theme .class-modal__error {
  font-size: var(--app-theme-font-size-xs, 13px);
}

:root.app-theme .class-modal__section-title,
:root.app-theme .class-modal__input,
:root.app-theme .class-modal__textarea,
:root.app-theme .class-modal__select,
:root.app-theme .class-modal .students-topbar-search__input,
:root.app-theme .class-modal__member-name,
:root.app-theme .class-modal__actions .btn {
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .class-modal__member-meta {
  font-size: var(--app-theme-font-size-sm, 14px);
}

:root.app-theme .class-modal__close,
:root.app-theme .class-modal .students-topbar-search__toggle,
:root.app-theme .class-modal__paint-btn,
:root.app-theme .class-modal__actions .btn {
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
}

:root.app-theme .class-modal__close:hover,
:root.app-theme .class-modal__close:focus-visible,
:root.app-theme .class-modal .students-topbar-search__toggle.is-active,
:root.app-theme .class-modal .students-topbar-search__toggle:hover,
:root.app-theme .class-modal .students-topbar-search__toggle:focus-visible,
:root.app-theme .class-modal__paint-btn:hover,
:root.app-theme .class-modal__paint-btn:focus-visible,
:root.app-theme .class-modal__actions .btn:hover,
:root.app-theme .class-modal__actions .btn:focus-visible {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .class-modal__close:focus-visible,
:root.app-theme .class-modal__resize-handle:focus-visible,
:root.app-theme .class-modal .students-topbar-search__toggle:focus-visible,
:root.app-theme .class-modal__paint-btn:focus-visible,
:root.app-theme .class-modal__actions .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-primary, #e66a2c) 35%, transparent);
  outline-offset: 2px;
}

:root.app-theme .class-modal__input,
:root.app-theme .class-modal__textarea,
:root.app-theme .class-modal__select,
:root.app-theme .class-modal .students-topbar-search__input {
  min-height: 46px;
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
}

:root.app-theme .class-modal__input:focus,
:root.app-theme .class-modal__textarea:focus,
:root.app-theme .class-modal__select:focus,
:root.app-theme .class-modal .students-topbar-search__input:focus,
:root.app-theme .class-modal .students-topbar-search__input:focus-visible {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
}

:root.app-theme .class-modal__select {
  cursor: pointer;
  outline: 1px solid transparent;
  scrollbar-color: var(--accent-primary, #e66a2c) var(--bg-muted, #f8fafc);
}

:root.app-theme .class-modal__select option {
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  outline-color: var(--accent-primary, #e66a2c);
  padding: 10px 12px;
}

:root.app-theme .class-modal__select option:hover,
:root.app-theme .class-modal__select option:checked {
  background: var(--accent-soft, #fdece0);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .class-modal__dropdown {
  position: relative;
  width: 100%;
}

:root.app-theme .class-modal__dropdown-trigger {
  width: 100%;
  min-height: 46px;
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  line-height: 1.35;
  text-align: left;
  box-sizing: border-box;
}

:root.app-theme .class-modal__dropdown-trigger:hover,
:root.app-theme .class-modal__dropdown-trigger:focus-visible,
:root.app-theme .class-modal__dropdown.is-open .class-modal__dropdown-trigger {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
}

:root.app-theme .class-modal__dropdown-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root.app-theme .class-modal__dropdown-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  opacity: 0.72;
  pointer-events: none;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

:root.app-theme .class-modal__dropdown.is-open .class-modal__dropdown-chevron {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

:root.app-theme .class-modal__dropdown-menu {
  position: fixed;
  z-index: 10020;
  top: var(--class-dropdown-top, 0);
  left: var(--class-dropdown-left, 0);
  width: var(--class-dropdown-width, 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--accent-primary, #e66a2c);
  border-radius: var(--radius-md, 14px);
  background: var(--bg-panel, #ffffff);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--text-primary, #0f172a) 16%, transparent);
  max-height: 240px;
  overflow-y: auto;
}

:root.app-theme .class-modal__dropdown-menu[hidden] {
  display: none;
}

:root.app-theme .class-modal__dropdown-option {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  line-height: 1.25;
  text-align: left;
}

:root.app-theme .class-modal__dropdown-option:hover,
:root.app-theme .class-modal__dropdown-option:focus-visible,
:root.app-theme .class-modal__dropdown-option.is-selected {
  outline: none;
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .class-modal__dropdown-option.is-selected {
  font-weight: 700;
}

:root.app-theme .class-modal__section,
:root.app-theme .class-modal__section-head,
:root.app-theme .class-modal__member,
:root.app-theme .class-modal__members-empty,
:root.app-theme .class-modal__color-popover {
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .class-modal__section {
  border-radius: var(--radius-md, 14px);
}

:root.app-theme .class-modal__section-summary {
  padding-inline: 10px 4px;
}

:root.app-theme .class-modal__section-body {
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .class-modal__member:hover,
:root.app-theme .class-modal__member.is-active {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
}

:root.app-theme .class-modal__member input {
  accent-color: var(--accent-primary, #e66a2c);
}

:root.app-theme .class-modal__resize-handle::before,
:root.app-theme .class-modal__resize-handle::after {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 35%, transparent);
}

:root.app-theme .class-modal__color-popover {
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--text-primary, #0f172a) 16%, transparent);
}

:root.app-theme .class-modal__paint-btn {
  background: color-mix(in srgb, var(--accent-soft, #fdece0) 45%, var(--bg-panel, #ffffff));
  border-color: color-mix(in srgb, var(--accent-primary, #e66a2c) 32%, var(--border-default, #dbe5f0));
}

:root.app-theme .class-modal__color-option:hover {
  border-color: var(--border-strong, #cbd5e1);
}

:root.app-theme .class-modal__color-option.is-selected {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary, #e66a2c) 18%, transparent);
}

:root.app-theme .class-modal__paint-btn.is-active {
  border-color: var(--class-modal-picked-color, var(--accent-primary, #e66a2c));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text-primary, #0f172a) 12%, transparent);
}

:root.app-theme .class-modal__paint-swatch {
  border-color: var(--bg-panel, #ffffff);
  box-shadow: 0 0 0 1px var(--border-strong, #cbd5e1);
}

:root.app-theme .class-modal__error {
  color: var(--danger, #b91c1c);
}

:root.app-theme .class-modal__actions .btn {
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--text-primary, #0f172a) 8%, transparent);
}

:root.app-theme .class-modal__actions .btn.primary {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #ffffff);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent-primary, #e66a2c) 25%, transparent);
}

:root.app-theme .class-modal__actions .btn.primary:hover,
:root.app-theme .class-modal__actions .btn.primary:focus-visible {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
  color: var(--text-on-accent, #ffffff);
}

.lesson-create-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--text-primary, #0f172a) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.lesson-create-modal {
  width: min(560px, 94vw);
  max-height: 88vh;
  background: var(--bg-panel, #fff);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 20%, transparent);
  display: flex;
  flex-direction: column;
  overflow: visible;
  font-family: var(--app-theme-font-family, inherit);
  color: var(--text-primary, #0f172a);
}

.lesson-create-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-default, #e6e9ef);
  border-radius: var(--radius-md, 14px) var(--radius-md, 14px) 0 0;
  background: var(--bg-panel, #fff);
}

.lesson-create-modal__title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-title, 18px);
  font-weight: 900;
}

.lesson-create-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.lesson-create-modal__close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm, 10px);
  padding: 0;
  border: 1px solid var(--border-default, #dbe5f0);
  background: var(--bg-panel, #fff);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lesson-create-modal__close img {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.18s ease;
}

.lesson-create-modal__close:hover,
.lesson-create-modal__close:focus-visible {
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
}

.lesson-create-modal__close:hover img,
.lesson-create-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.lesson-create-modal__body {
  padding: 18px;
  overflow: visible;
}

.lesson-create-modal__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-create-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.lesson-create-modal__field--full {
  grid-column: 1 / -1;
}

.lesson-create-modal__label {
  font-size: var(--app-theme-font-size-tooltip, 13px);
  color: var(--text-secondary, #334155);
  font-weight: 650;
}

.lesson-create-modal__hint {
  margin-top: 10px;
  font-size: var(--app-theme-font-size-tooltip, 12px);
  line-height: 1.4;
  color: var(--text-secondary, #64748b);
}

.lesson-create-modal__visibility {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm, 10px);
  border: 1px solid var(--border-default, #dbe5f0);
  background: var(--bg-app, #f8fafc);
  cursor: pointer;
}

.lesson-create-modal__visibility-text {
  font-size: var(--app-theme-font-size-md, 14px);
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.lesson-create-modal__switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
}

.lesson-create-modal__switch-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.lesson-create-modal__switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border-strong, #cbd5e1);
  transition: background 0.18s ease;
}

.lesson-create-modal__switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-panel, #fff);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
  transition: transform 0.18s ease;
}

.lesson-create-modal__switch-input:checked + .lesson-create-modal__switch-slider {
  background: var(--accent-primary, #e66a2c);
}

.lesson-create-modal__switch-input:checked + .lesson-create-modal__switch-slider::after {
  transform: translateX(20px);
}

.lesson-create-modal__switch-input:focus-visible + .lesson-create-modal__switch-slider {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 15%, transparent);
}

.lesson-create-modal__input,
.lesson-create-modal__select {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border-default, #d6dbe3);
  border-radius: var(--radius-sm, 10px);
  font-size: var(--app-theme-font-size-md, 14px);
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-panel, #fff);
  font-family: var(--app-theme-font-family, inherit);
  color: var(--text-primary, #0f172a);
}

.lesson-create-modal__dropdown {
  position: relative;
  width: 100%;
}

.lesson-create-modal__dropdown-trigger {
  width: 100%;
  min-height: 46px;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--border-default, #d6dbe3);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #fff);
  font-family: var(--app-theme-font-family, inherit);
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-md, 14px);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-sizing: border-box;
  position: relative;
}

.lesson-create-modal__dropdown-trigger:hover {
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
}

.lesson-create-modal__dropdown-trigger:focus-visible,
.lesson-create-modal__dropdown.is-open .lesson-create-modal__dropdown-trigger {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 15%, transparent);
}

.lesson-create-modal__dropdown-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-create-modal__dropdown-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  transition: transform 0.16s ease;
  opacity: 0.7;
  pointer-events: none;
}

.lesson-create-modal__dropdown.is-open .lesson-create-modal__dropdown-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.lesson-create-modal__dropdown-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  background: var(--bg-panel, #fff);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--text-primary, #0f172a) 16%, transparent);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.lesson-create-modal__dropdown-menu[hidden] {
  display: none;
}

.lesson-create-modal__dropdown-option {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #fff);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 14px);
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.lesson-create-modal__dropdown-option:hover,
.lesson-create-modal__dropdown-option:focus-visible {
  outline: none;
  background: var(--accent-soft, #eff6ff);
  border-color: var(--accent-primary, #e66a2c);
}

.lesson-create-modal__dropdown-option.is-selected {
  background: var(--accent-soft, #eff6ff);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
  font-weight: 700;
}

.lesson-folder-modal .lesson-create-modal__dropdown-trigger {
  padding-right: 44px;
}

.lesson-folder-modal .lesson-create-modal__dropdown-chevron {
  right: 18px;
}

.lesson-create-modal__input[readonly] {
  background: var(--bg-app, #f8fafc);
  color: var(--text-secondary, #475467);
}

.lesson-create-modal__input:focus,
.lesson-create-modal__select:focus {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 15%, transparent);
}

.lesson-create-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-default, #e6e9ef);
  border-radius: 0 0 var(--radius-md, 14px) var(--radius-md, 14px);
  background: var(--bg-panel, #fff);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-create-modal__error {
  margin-top: 10px;
  color: var(--danger, #b91c1c);
  font-size: var(--app-theme-font-size-tooltip, 13px);
}

.lesson-create-modal__subject-warning {
  padding-left: 16px;
  border-left: 3px solid var(--border-default, #e6e9ef);
  color: var(--text-primary, #101828);
}

.lesson-create-modal__subject-warning-heading {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: var(--app-theme-font-size-md, 16px);
}

.lesson-create-modal__subject-warning-icon {
  display: block;
  width: 24px;
  height: 24px;
  align-self: center;
  object-fit: contain;
}

.lesson-create-modal__subject-warning-heading strong {
  display: flex;
  align-items: center;
  min-height: 24px;
  margin: 0;
  line-height: 1.25;
}

.lesson-create-modal__subject-warning p {
  margin: 4px 0 0;
  color: var(--text-primary, #101828);
  font-size: var(--app-theme-font-size-sm, 14px);
}

.lesson-create-modal__subject-warning-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--accent-primary, #e66a2c);
  font-size: var(--app-theme-font-size-sm, 14px);
  font-weight: 700;
}

.lesson-create-modal__status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 28px;
  min-height: 28px;
}

.lesson-create-modal__status-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.lesson-create-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.lesson-create-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: var(--radius-sm, 10px);
  font-weight: 800;
  font-family: var(--app-theme-font-family, inherit);
  border: 1px solid var(--border-default, #cbd5e1);
  background: var(--bg-app, #e2e8f0);
  color: var(--text-primary, #1f2937);
  font-size: var(--app-theme-font-size-md, 14px);
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.lesson-create-modal__actions .btn:hover {
  background: var(--accent-soft, #d7e0eb);
  border-color: var(--border-strong, #bfcada);
}

.lesson-create-modal__actions .btn.primary {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent-primary, #e66a2c) 25%, transparent);
}

.lesson-create-modal__actions .btn.primary:hover {
  background: var(--accent-primary-hover, #c9561f);
}

.lesson-folder-modal__colors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.lesson-folder-modal__color-btn {
  position: relative;
  min-height: 40px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: var(--folder-color, #dbeafe);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.lesson-folder-modal__color-btn:hover,
.lesson-folder-modal__color-btn:focus-visible {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.lesson-folder-modal__color-btn.is-selected {
  border-color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.08);
}

.lesson-folder-modal__color-check {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  display: none;
}

.lesson-folder-modal__color-btn.is-selected .lesson-folder-modal__color-check {
  display: block;
}

.media-folder-delete-modal {
  width: min(560px, 94vw);
}

.media-folder-delete-modal__intro {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.media-folder-delete-modal__folder {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.media-folder-delete-modal__meta {
  font-size: 13px;
  color: #475569;
}

.media-folder-delete-modal__choices {
  display: grid;
  gap: 10px;
}

.media-folder-delete-modal__choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.media-folder-delete-modal__choice:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
}

.media-folder-delete-modal__choice input[type="radio"] {
  margin: 1px 0 0;
}

.media-folder-delete-modal__choice-copy {
  min-width: 0;
}

.media-folder-delete-modal__choice-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.media-folder-delete-modal__description {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d6dbe3;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .class-modal-overlay {
    padding-top: 24px;
  }

  .class-modal__grid {
    grid-template-columns: 1fr;
  }

  .class-modal__section-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .class-modal__members-list {
    grid-template-columns: 1fr;
  }

  .class-modal__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .class-modal__footer-tools {
    justify-content: flex-start;
  }

  .class-modal__color-popover {
    left: 0;
    bottom: calc(100% + 10px);
    max-width: min(100vw - 48px, 264px);
  }

  .class-modal__actions {
    width: 100%;
    margin-left: 0;
  }

  .class-modal__actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .lesson-create-modal__form {
    grid-template-columns: 1fr;
  }

  .lesson-create-modal__actions .btn {
    min-width: 0;
    flex: 1 1 0;
  }

  .lesson-folder-modal__colors {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.working-hours-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 24px;
  background: rgba(15, 23, 42, 0.46);
  overflow-y: auto;
}

.working-hours-modal-shell {
  width: min(600px, 100%);
  border-radius: 12px;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  color: #0f172a;
}

.working-hours-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #dbe5f0;
}

.working-hours-modal__title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.working-hours-modal__title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.working-hours-modal__title-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: block;
}

.working-hours-modal__subtitle {
  color: #64748b;
}

.working-hours-modal__close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.working-hours-modal__close img {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 0.18s ease;
}

.working-hours-modal__close:hover,
.working-hours-modal__close:focus-visible {
  background: #eef2f7;
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.working-hours-modal__close:hover img,
.working-hours-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.working-hours-modal__body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.working-hours-modal__meta {
  display: flex;
  justify-content: flex-end;
  min-height: 18px;
}

.working-hours-modal__mode {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.working-hours-modal__mode-btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.working-hours-modal__mode-btn.is-active {
  border-color: #93c5fd;
  background: #eaf3ff;
  color: #1d4ed8;
}

.working-hours-modal__panel-frame {
  height: 120px;
  overflow: hidden;
  align-content: space-evenly;
  transition: height 220ms ease;
}

.working-hours-modal__panel-frame.is-inactive {
  opacity: 0.52;
}

.working-hours-modal__panel-frame.is-inactive .working-hours-modal__panel:not([data-panel="none"]) {
  pointer-events: none;
}

.working-hours-modal__panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
}

.working-hours-modal__panel[data-panel="weekly"] {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.working-hours-modal__panel[hidden],
.working-hours-modal__error[hidden] {
  display: none !important;
}

.working-hours-modal__simple-weekdays {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.working-hours-modal__simple-weekdays[hidden] {
  display: none !important;
}

.working-hours-modal__row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.working-hours-modal__label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.working-hours-modal__panel--simple {
  align-content: center;
  justify-items: center;
}

.working-hours-modal__simple-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 100%;
}

.working-hours-modal__simple-divider {
  width: 56px;
  height: 1px;
  background: #dbe5f0;
  flex: 0 0 auto;
}

.working-hours-modal__input-wrap--simple {
  width: 120px;
  min-width: 120px;
}

.working-hours-modal__input-wrap--simple-start {
  justify-content: flex-start;
}

.working-hours-modal__input-wrap--simple-end {
  justify-content: flex-end;
}

.working-hours-modal__input {
  width: 100%;
  min-height: 40px;
  padding: 8px 42px 8px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.working-hours-modal__input::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 0;
  margin: 0;
  pointer-events: none;
}

.working-hours-modal__input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.working-hours-modal__input-icon {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
  color: #64748b;
  pointer-events: none;
}

.working-hours-modal__input-icon--left {
  left: 12px;
  right: auto;
}

.working-hours-modal__input-icon--right {
  left: auto;
  right: 12px;
}

.working-hours-modal__input--simple-start {
  padding-left: 44px;
  padding-right: 12px;
}

.working-hours-modal__input--simple-end {
  padding-left: 12px;
  padding-right: 44px;
}

.working-hours-modal__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__toggle input {
  width: 16px;
  height: 16px;
}

.working-hours-modal__toggle--weekday {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
}

.working-hours-modal__toggle--weekday.is-active {
  border-color: #93c5fd;
  background: #eaf3ff;
  color: #1d4ed8;
}

.working-hours-modal__toggle--weekday.is-disabled {
  opacity: 0.55;
}

.working-hours-modal__panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.working-hours-modal__panel-actions .btn {
  min-height: 40px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
}

.working-hours-modal__table {
  display: grid;
  align-content: start;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.working-hours-modal__week-row {
  display: grid;
  grid-template-columns: 84px 120px minmax(0, 1fr) minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
}

.working-hours-modal__week-day {
  margin-left: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.working-hours-modal__clear-btn {
  min-height: 32px;
  border: none;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.working-hours-modal__clear-btn:hover {
  color: #0f172a;
}

.working-hours-modal__error {
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.working-hours-modal__none-hint {
  color: #64748b;
  transition: color 180ms ease, opacity 180ms ease;
}

.working-hours-modal__none-hint.is-active {
  color: #334155;
}

.working-hours-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 18px;
}

.working-hours-modal__switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.working-hours-modal__switch-row.is-disabled {
  opacity: 0.55;
}

.working-hours-modal__switch-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__switch-label[hidden] {
  display: none !important;
}

.working-hours-modal__switch {
  position: relative;
  width: 50px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.working-hours-modal__switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.working-hours-modal__switch-track {
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid #94a3b8;
  position: relative;
  transition: background-color .2s ease, border-color .2s ease;
}

.working-hours-modal__switch-track::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform .2s ease;
}

.working-hours-modal__switch input:checked + .working-hours-modal__switch-track {
  background: #2563eb;
  border-color: #1d4ed8;
}

.working-hours-modal__switch input:checked + .working-hours-modal__switch-track::after {
  transform: translateX(22px);
}

.working-hours-modal__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.working-hours-modal__actions .btn {
  min-width: 148px;
  min-height: 40px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
}

.working-hours-modal__actions .btn {
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
}

.working-hours-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.working-hours-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.working-hours-modal__actions .btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

@media (max-width: 720px) {
  .working-hours-modal-overlay {
    padding-top: 24px;
  }

  .working-hours-modal__panel-frame {
    min-height: 0;
  }

  .working-hours-modal__row {
    grid-template-columns: 1fr;
  }

  .working-hours-modal__week-row {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .working-hours-modal__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .working-hours-modal__footer-start {
    width: 100%;
  }

  .working-hours-modal__actions {
    width: 100%;
  }

  .working-hours-modal__actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

.working-hours-modal-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 46%, transparent);
}

.working-hours-modal-shell {
  background: var(--bg-app, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 48px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

.working-hours-modal__header {
  border-bottom-color: var(--border-default, #dbe5f0);
}

.working-hours-modal__title {
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-title, 20px);
}

.working-hours-modal__subtitle,
.working-hours-modal__input-icon,
.working-hours-modal__clear-btn,
.working-hours-modal__none-hint {
  color: var(--text-secondary, #64748b);
}

.working-hours-modal__close,
.working-hours-modal__mode-btn,
.working-hours-modal__toggle--weekday,
.working-hours-modal__week-row,
.working-hours-modal__actions .btn,
.working-hours-modal__panel-actions .btn {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
  color: var(--text-primary, #0f172a);
}

.working-hours-modal__close {
  position: relative;
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text-primary, #0f172a) 8%, transparent);
}

.working-hours-modal__close img {
  position: absolute;
  inset: 50% auto auto 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.working-hours-modal__close::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  transform-origin: center;
  transition: transform 0.18s ease;
}

.working-hours-modal__close:hover,
.working-hours-modal__close:focus-visible,
.working-hours-modal__actions .btn:hover,
.working-hours-modal__panel-actions .btn:hover {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-strong, #cbd5e1);
}

.working-hours-modal__close:hover,
.working-hours-modal__close:focus-visible {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

.working-hours-modal__close:hover::before,
.working-hours-modal__close:focus-visible::before {
  transform: rotate(90deg);
}

.working-hours-modal__mode-btn,
.working-hours-modal__label,
.working-hours-modal__toggle,
.working-hours-modal__switch-label,
.working-hours-modal__error {
  font-size: var(--app-theme-font-size-sm, 14px);
}

.working-hours-modal__actions .btn,
.working-hours-modal__panel-actions .btn {
  border-radius: var(--radius-sm, 10px);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-sm, 14px);
  line-height: 1.2;
}

.working-hours-modal__clear-btn {
  font-size: var(--app-theme-font-size-xs, 13px);
}

.working-hours-modal__mode-btn.is-active,
.working-hours-modal__toggle--weekday.is-active {
  background: var(--accent-soft, #fdece0);
  border-color: color-mix(in srgb, var(--accent-primary, #e66a2c) 40%, var(--border-default, #dbe5f0));
  color: var(--accent-primary, #e66a2c);
}

.working-hours-modal__simple-divider {
  background: var(--border-default, #dbe5f0);
}

.working-hours-modal__input {
  background: var(--bg-panel, #fff);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

.working-hours-modal__input:focus {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 18%, transparent);
}

.working-hours-modal__label,
.working-hours-modal__toggle,
.working-hours-modal__week-day,
.working-hours-modal__none-hint.is-active,
.working-hours-modal__switch-label,
.working-hours-modal__clear-btn:hover {
  color: var(--text-primary, #0f172a);
}

.working-hours-modal__week-day {
  font-size: var(--app-theme-font-size-lg, 17px);
}

.working-hours-modal__switch-track {
  background: var(--border-strong, #cbd5e1);
  border-color: var(--text-muted, #94a3b8);
}

.working-hours-modal__switch-track::after {
  background: var(--bg-panel, #fff);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text-primary, #0f172a) 25%, transparent);
}

.working-hours-modal__switch input:checked + .working-hours-modal__switch-track {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
}

.working-hours-modal__actions .btn.primary {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #fff);
}

.working-hours-modal__actions .btn.primary:hover {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
}

.working-hours-modal__error {
  color: #b91c1c;
}

.fb-view-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.fb-view-line {
  font-size: 13px;
  color: #334155;
}

.fb-chip {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #0f172a;
}

.fb-chip.new { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.fb-chip.viewed { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.fb-chip.closed { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.fb-view-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fb-view-images img {
  width: 120px;
  height: 90px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.custom-modal.sticker-settings-modal {
    width: min(640px, 94vw);
    min-width: min(540px, 94vw);
    overflow: visible;
}
.custom-modal-overlay:has(.custom-modal.sticker-settings-modal) {
    align-items: flex-start;
    padding-top: 28px;
    padding-bottom: 20px;
}
.custom-modal.sticker-settings-modal .custom-modal-title {
    align-items: stretch;
    justify-content: center;
    width: 160px;
    padding: 24px 18px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}
.custom-modal.sticker-settings-modal .sticker-settings__heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__titleIcon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
}
.custom-modal.sticker-settings-modal .sticker-settings__titleIcon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}
.custom-modal.sticker-settings-modal .custom-modal-content {
    padding: 20px 20px 18px;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: visible;
}
.custom-modal.sticker-settings-modal .custom-modal-body {
    gap: 14px;
    overflow: visible;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack {
    position: relative;
    width: 100%;
    min-height: 220px;
    height: 100%;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group {
    display: block;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card {
    width: 120px;
    height: 120px;
    padding: 12px;
    box-sizing: border-box;
    appearance: none;
    border-radius: 18px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    cursor: default;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selectable {
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selectable:hover {
    border-color: rgba(59, 130, 246, 0.38);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selected {
    border-color: rgba(37, 99, 235, 0.72);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16), 0 14px 30px rgba(15, 23, 42, 0.14);
    transform: translateX(-2px);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group .sticker-settings__preview-card.is-selected {
    transform: translateX(calc(-50% - 2px));
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-single .sticker-settings__preview-card {
    width: 136px;
    height: 136px;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group .sticker-settings__preview-card {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8fafc;
}
.custom-modal.sticker-settings-modal .sticker-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.custom-modal.sticker-settings-modal .sticker-settings__label {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}
.custom-modal.sticker-settings-modal .sticker-settings__textarea {
    min-height: 168px;
    resize: vertical;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-picker {
    position: relative;
}
.custom-modal.sticker-settings-modal .sticker-settings__fontRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 12px;
    align-items: end;
}
.custom-modal.sticker-settings-modal .sticker-settings__fontField {
    min-width: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__colorField {
    width: 72px;
}
.custom-modal.sticker-settings-modal .sticker-settings__sizeField--topRow {
    min-width: 0;
    width: 132px;
    justify-self: end;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
    position: relative;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-65%) rotate(45deg);
    transition: transform .18s ease;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-picker.is-open .sticker-settings__font-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-secondary, #475569);
    white-space: nowrap;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 12;
}
.custom-modal.sticker-settings-modal .sticker-settings__inlineRow {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.custom-modal.sticker-settings-modal .sticker-settings__field--compact {
    min-width: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__sizeField {
    position: relative;
}
.custom-modal.sticker-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}
.custom-modal.sticker-settings-modal .text-settings__color-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__color-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.custom-modal.sticker-settings-modal .text-settings__color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.custom-modal.sticker-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 0 38px 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger:hover {
    border-color: #cbd5e1;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}
.custom-modal.sticker-settings-modal .text-settings__size-picker.is-open .text-settings__size-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}
.custom-modal.sticker-settings-modal .text-settings__size-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}
.custom-modal.sticker-settings-modal .text-settings__size-menu[hidden] {
    display: none !important;
}
.custom-modal.sticker-settings-modal .text-settings__size-presets {
    display: grid;
    gap: 8px;
    padding-right: 8px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}
.custom-modal.sticker-settings-modal .text-settings__size-preset {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__size-preset:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .text-settings__size-preset.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__size-slider-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 332px;
    padding-left: 0;
    min-width: 0;
}
.custom-modal.sticker-settings-modal .text-settings__size-range {
    width: 18px;
    height: 220px;
    min-height: 220px;
    margin: 0;
    writing-mode: vertical-lr;
}
.custom-modal.sticker-settings-modal .text-settings__choiceGroup {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton {
    min-height: 44px;
    border: 0;
    border-right: 1px solid var(--border-default, #dbe5f0);
    border-radius: 0;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:last-child {
    border-right: 0;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton--text {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton.is-active {
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__choiceText {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}
.custom-modal.sticker-settings-modal .text-settings__switchRow {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .text-settings__switchRow.sticker-settings__switchRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.custom-modal.sticker-settings-modal .text-settings__switchLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
.custom-modal.sticker-settings-modal .text-settings__switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .text-settings__switchTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__switchTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:hover + .text-settings__switchTrack {
    border-color: #cbd5e1;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:focus-visible + .text-settings__switchTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack::after {
    transform: translateX(18px);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:disabled + .text-settings__switchTrack {
    opacity: 0.55;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option:hover,
.custom-modal.sticker-settings-modal .sticker-settings__font-option.is-selected {
    background: #f8fafc;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option.is-selected {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    line-height: 1.2;
    white-space: nowrap;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.custom-modal.sticker-settings-modal .sticker-settings__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .sticker-settings__checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .sticker-settings__checkbox input[type="checkbox"] {
    margin: 0;
}
.custom-modal.sticker-settings-modal .sticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    border: 1px solid #dbe5f0;
    background: #f8fafc;
    color: #21324a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 720px) {
    .custom-modal.sticker-settings-modal {
        min-width: 0;
        width: min(96vw, 560px);
    }

    .custom-modal.sticker-settings-modal .custom-modal-title {
        width: 100%;
        min-height: 156px;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.sticker-settings-modal .custom-modal-content {
        border-top-right-radius: 0;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-stack {
        min-height: 108px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__fontRow {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-modal.sticker-settings-modal .sticker-settings__sizeField--topRow {
        width: 100%;
        justify-self: stretch;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__colorField {
        width: 100%;
        justify-self: stretch;
    }

    .custom-modal.sticker-settings-modal .text-settings__colorRow {
        justify-content: flex-start;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__inlineRow {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-card {
        width: 96px;
        height: 96px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-single .sticker-settings__preview-card {
        width: 112px;
        height: 112px;
    }
}

.custom-modal.crossword-settings-modal {
    display: flex;
    flex-direction: column;
    width: min(640px, calc(100vw - 32px));
    min-width: 0;
    max-height: min(calc(100dvh - 32px), 720px);
    min-height: 0;
    border-radius: 16px;
    font-family: var(--app-theme-font-family, inherit);
    /* Clips children to the rounded box: the previous build let its header
       and content leak past this box because they were width:100% +
       content-box (N2 in the redesign audit). */
    overflow: hidden;
    box-sizing: border-box;
}

.custom-modal.crossword-settings-modal,
.custom-modal.crossword-settings-modal .custom-modal-title,
.custom-modal.crossword-settings-modal .custom-modal-content,
.custom-modal.crossword-settings-modal .custom-modal-body {
    box-sizing: border-box;
}

.custom-modal-overlay:has(.custom-modal.crossword-settings-modal) {
    align-items: center;
    padding: 24px 16px;
}

/* ---------------------------- Header: fixed, never scrolls ---------------------------- */
.custom-modal.crossword-settings-modal .custom-modal-title {
    position: relative;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    max-width: none;
    padding: 16px 20px;
    border-right: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: var(--bg-panel);
    overflow: visible;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .custom-modal-title.is-stuck {
    border-bottom-color: var(--border-default);
    box-shadow: 0 6px 12px -10px rgba(15, 23, 42, 0.5);
}

/* v2: leading icon chip, borrowed from image-grid-split-modal's own header
   (pencil glyph before "Редагування"). 40x40 / radius-sm / accent-soft bg. */
.custom-modal.crossword-settings-modal .crossword-settings__headerIcon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-top: 2px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-primary);
}

.custom-modal.crossword-settings-modal .crossword-settings__headerIcon svg {
    width: 20px;
    height: 20px;
}

.custom-modal.crossword-settings-modal .crossword-settings__header {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.custom-modal.crossword-settings-modal .crossword-settings__heading {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-lg, 17px);
    font-weight: 800;
    line-height: 1.25;
}

.custom-modal.crossword-settings-modal .crossword-settings__lead {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: var(--app-theme-font-size-sm, 14px);
    line-height: 1.45;
}

.custom-modal.crossword-settings-modal .custom-modal-close {
    position: static;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-secondary);
    z-index: 1;
    transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.custom-modal.crossword-settings-modal .custom-modal-close img {
    width: 16px;
    height: 16px;
    transition: transform 0.16s ease;
}

.custom-modal.crossword-settings-modal .custom-modal-close:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--bg-muted);
    color: var(--text-primary);
}

.custom-modal.crossword-settings-modal .custom-modal-close:hover img,
.custom-modal.crossword-settings-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.crossword-settings-modal .custom-modal-close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ---------------------------- Content shell ---------------------------- */
.custom-modal.crossword-settings-modal .custom-modal-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    background: var(--bg-panel);
    overflow: hidden;
    position: static;
}

/* ---------------------------- Body: the only scroller ---------------------------- */
.custom-modal.crossword-settings-modal .custom-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 0;
    padding: 2px 20px 8px;
}

.custom-modal.crossword-settings-modal .crossword-settings__header {
    display: grid;
    gap: 4px;
}

/* v2: sections read as grouped panels, not hairline-divided text rows —
   borrowed from image-grid-split-modal, where each named group is a bold
   sentence-case heading over a soft bordered card, separated from the next
   group by whitespace instead of a divider rule. */
.custom-modal.crossword-settings-modal .crossword-settings__section {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.custom-modal.crossword-settings-modal .crossword-settings__section + .crossword-settings__section {
    margin-top: 20px;
}

.custom-modal.crossword-settings-modal .crossword-settings__section:first-child {
    padding-top: 4px;
}

.custom-modal.crossword-settings-modal .crossword-settings__section[hidden] {
    display: none;
}

.custom-modal.crossword-settings-modal .crossword-settings__sectionTitle {
    margin: 0 0 10px;
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-md, 15px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
}

.custom-modal.crossword-settings-modal .crossword-settings__sectionCard {
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-muted);
}

.custom-modal.crossword-settings-modal .crossword-settings__row {
    display: grid;
    grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
    align-items: center;
    gap: 8px 16px;
    min-height: 44px;
    padding: 3px 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__row + .crossword-settings__row {
    margin-top: 2px;
}

.custom-modal.crossword-settings-modal .crossword-settings__row--nav {
    align-items: start;
}

.custom-modal.crossword-settings-modal .crossword-settings__row--nav .crossword-settings__label {
    padding-top: 16px;
}

.custom-modal.crossword-settings-modal .crossword-settings__label {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 600;
    line-height: 1.35;
}

.custom-modal.crossword-settings-modal .crossword-settings__control {
    min-width: 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__control--narrow {
    max-width: 180px;
}

.custom-modal.crossword-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal.crossword-settings-modal .text-settings__color-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-modal.crossword-settings-modal .text-settings__color-btn:hover {
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.custom-modal.crossword-settings-modal .text-settings__color-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.custom-modal.crossword-settings-modal .crossword-settings__colorValue {
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs, 13px);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    text-transform: uppercase;
}

.custom-modal.crossword-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger {
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary, #64748b);
    border-bottom: 2px solid var(--text-secondary, #64748b);
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.crossword-settings-modal .text-settings__size-picker.is-open .text-settings__size-trigger {
    border-color: var(--accent-primary);
}

.custom-modal.crossword-settings-modal .text-settings__size-picker.is-open .text-settings__size-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger:hover {
    border-color: var(--border-strong);
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Portaled to the overlay (a position:fixed layer positioned by script from
   the trigger rect) so the panel is never clipped by the now-scrollable
   modal body — README_CSS.md's custom-dropdown-in-scroll-container rule.
   Once portaled the menu is a sibling of .crossword-settings-modal, not a
   descendant, so this and every rule below it must key off the menu's own
   .crossword-settings__sizeMenu class rather than a modal-ancestor selector. */
.crossword-settings__sizeMenu {
    position: fixed;
    z-index: 10020;
    display: grid;
    grid-template-columns: 64px 40px;
    gap: 12px;
    width: auto;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.crossword-settings__sizeMenu[hidden] {
    display: none !important;
}

.crossword-settings__sizeMenu .text-settings__size-presets {
    display: grid;
    gap: 10px;
    padding-right: 12px;
    border-right: 1px solid var(--border-default);
}

.crossword-settings__sizeMenu .text-settings__size-preset {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-muted);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.crossword-settings__sizeMenu .text-settings__size-preset:hover {
    border-color: var(--border-strong);
    background: var(--bg-panel);
}

.crossword-settings__sizeMenu .text-settings__size-preset.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent-primary);
}

.crossword-settings__sizeMenu .text-settings__size-preset:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.crossword-settings__sizeMenu .text-settings__size-slider-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.crossword-settings__sizeMenu .text-settings__size-range {
    width: 18px;
    height: 156px;
    min-height: 156px;
    margin: 0;
    writing-mode: vertical-lr;
    accent-color: var(--accent-primary);
}

.crossword-settings__sizeMenu .text-settings__size-range:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

/* ---------------------------- Navigation ---------------------------- */
.custom-modal.crossword-settings-modal .crossword-settings__navGroup {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    padding: 4px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-md);
    /* v2: white, not --bg-muted — the group now sits on a muted section
       card, so the track needs to read as a distinct layer on top of it. */
    background: var(--bg-panel);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 58px;
    padding: 8px 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary, #475569);
    font-size: var(--app-theme-font-size-sm, 14px);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .crossword-settings__navLabel {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGlyph {
    display: block;
    line-height: 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGlyph svg {
    width: 46px;
    height: 18px;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGlyph rect {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGlyph .g-num {
    fill: currentColor;
    font-size: 9px;
    font-weight: 700;
    font-family: inherit;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGlyph .g-arrow {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.3;
    stroke-linecap: round;
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* Active state is never colour-only: ring + surface + weight + glyph emphasis. */
.custom-modal.crossword-settings-modal .crossword-settings__navButton.is-active {
    background: var(--bg-panel);
    color: var(--text-primary);
    font-weight: 800;
    box-shadow: inset 0 0 0 1.5px var(--accent-primary), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton.is-active .crossword-settings__navGlyph {
    color: var(--accent-primary);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -1px;
}

/* Live region: always rendered, collapses while empty so announcements are reliable. */
.custom-modal.crossword-settings-modal .crossword-settings__navNote {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-sm, 14px);
    line-height: 1.45;
}

.custom-modal.crossword-settings-modal .crossword-settings__navNote:not(:empty) {
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
}

/* ---------------------------- Numbering ---------------------------- */
.custom-modal.crossword-settings-modal .crossword-settings__numberingContent {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.custom-modal.crossword-settings-modal .crossword-settings__numberingText {
    min-width: 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__numberingTitle {
    display: block;
    color: var(--text-primary);
    font-size: var(--app-theme-font-size-md, 15px);
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.crossword-settings-modal .crossword-settings__numberingHint {
    margin: 3px 0 0;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-sm, 14px);
    line-height: 1.45;
}

/* Accent is the border, not the label: --accent-primary as text on white is
   3.06:1 in the default orange theme and fails WCAG AA for body-size text
   (N4 in the redesign audit). */
.custom-modal.crossword-settings-modal .crossword-settings__autoNumber {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.custom-modal.crossword-settings-modal .crossword-settings__autoNumber:hover {
    background: var(--accent-soft);
    border-color: var(--accent-primary-hover);
}

.custom-modal.crossword-settings-modal .crossword-settings__autoNumber:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.custom-modal.crossword-settings-modal .crossword-settings__autoNumber:disabled {
    cursor: wait;
    opacity: 0.6;
}

.custom-modal.crossword-settings-modal .crossword-settings__actionStatus {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--app-theme-font-size-xs, 13px);
    line-height: 1.4;
}

.custom-modal.crossword-settings-modal .crossword-settings__actionStatus:not(:empty) {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
}

.custom-modal.crossword-settings-modal .crossword-settings__actionStatus[data-state="success"] {
    color: var(--success, var(--accent-primary));
    background: var(--success-bg, var(--bg-panel));
}

.custom-modal.crossword-settings-modal .crossword-settings__actionStatus[data-state="error"] {
    color: var(--danger);
    background: var(--danger-bg, var(--bg-panel));
}

/* ---------------------------- Footer: pinned ---------------------------- */
.custom-modal.crossword-settings-modal .custom-modal-buttons {
    flex: 0 0 auto;
    margin-top: 0;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid transparent;
    background: var(--bg-panel);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .custom-modal-buttons.is-stuck {
    border-top-color: var(--border-default);
    box-shadow: 0 -6px 12px -10px rgba(15, 23, 42, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    .custom-modal.crossword-settings-modal,
    .custom-modal.crossword-settings-modal * {
        transition: none !important;
        animation: none !important;
    }
}

.custom-modal.wheel-settings-modal {
    width: min(860px, 94vw);
    min-width: min(720px, 94vw);
    max-height: 90vh;
    overflow: visible;
}

.custom-modal-overlay:has(.custom-modal.wheel-settings-modal) {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 20px;
}

.custom-modal.wheel-settings-modal,
.custom-modal.wheel-settings-modal * {
    box-sizing: border-box;
}

.custom-modal.wheel-settings-modal .custom-modal-title {
    align-items: stretch;
    justify-content: center;
    width: 164px;
    padding: 22px 16px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}

.custom-modal.wheel-settings-modal .custom-modal-content {
    min-width: 0;
    max-height: 90vh;
    padding: 18px 18px 16px;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: visible;
}

.custom-modal.wheel-settings-modal .custom-modal-body {
    gap: 14px;
    min-height: 0;
    overflow: visible;
}

.custom-modal.wheel-settings-modal .wheel-settings__preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 210px;
    text-align: center;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewCard {
    width: 116px;
    height: 116px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.custom-modal.wheel-settings-modal .wheel-settings__previewCard img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewMeta {
    display: grid;
    gap: 6px;
    width: 100%;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewEyebrow {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewHint {
    color: var(--text-primary, #0f172a);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.16;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-modal.wheel-settings-modal .wheel-settings__head {
    display: grid;
    gap: 12px;
    padding-right: 52px;
}

.custom-modal.wheel-settings-modal .wheel-settings__heading {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__tabs {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-app, #f8fafc);
    gap: 4px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tab {
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__tab:hover,
.custom-modal.wheel-settings-modal .wheel-settings__tab:focus-visible {
    background: rgba(255, 255, 255, 0.86);
}

.custom-modal.wheel-settings-modal .wheel-settings__tab.is-active {
    background: #ffffff;
    color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.custom-modal.wheel-settings-modal .wheel-settings__body {
    min-height: 0;
    max-height: min(560px, calc(90vh - 178px));
    overflow: auto;
    padding-right: 2px;
}

.custom-modal.wheel-settings-modal .wheel-settings__grid {
    display: grid;
    gap: 12px;
}

.custom-modal.wheel-settings-modal .wheel-settings__section {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
}

.custom-modal.wheel-settings-modal .wheel-settings__sectionTitle {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__fieldPair,
.custom-modal.wheel-settings-modal .wheel-settings__fieldColumns,
.custom-modal.wheel-settings-modal .wheel-settings__tileGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__fieldStack {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.custom-modal.wheel-settings-modal .wheel-settings__field,
.custom-modal.wheel-settings-modal .wheel-settings__field--color {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.custom-modal.wheel-settings-modal .wheel-settings__field--wide {
    grid-column: 1 / -1;
}

.custom-modal.wheel-settings-modal .wheel-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.wheel-settings-modal select.modalInput {
    min-height: 46px;
    padding: 0 40px 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    appearance: none;
    -webkit-appearance: none;
    background-color: #ffffff;
    background-image: url("/static/assets/icons/chevron-down.svg");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-modal.wheel-settings-modal select.modalInput:hover {
    border-color: var(--border-strong, #cbd5e1);
    background-color: #ffffff;
}

.custom-modal.wheel-settings-modal select.modalInput:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.wheel-settings-modal .wheel-settings__selectControl {
    position: relative;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectTrigger {
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 0 40px 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectTrigger:hover,
.custom-modal.wheel-settings-modal .wheel-settings__selectTrigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.wheel-settings-modal .wheel-settings__selectTrigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-secondary, #475569);
    border-bottom: 2px solid var(--text-secondary, #475569);
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectControl.is-open .wheel-settings__selectTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.wheel-settings-modal .wheel-settings__selectMenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 24;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-height: 236px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.custom-modal.wheel-settings-modal .wheel-settings__selectMenu[hidden] {
    display: none !important;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectMenu--list {
    grid-template-columns: 1fr;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectOption {
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectMenu--list .wheel-settings__selectOption {
    text-align: left;
}

.custom-modal.wheel-settings-modal .wheel-settings__selectOption:hover,
.custom-modal.wheel-settings-modal .wheel-settings__selectOption:focus-visible {
    outline: none;
    border-color: var(--border-default, #dbe5f0);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__selectOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.wheel-settings-modal .wheel-settings__field--spinDuration,
.custom-modal.wheel-settings-modal .wheel-settings__field--fontSize {
    position: relative;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetControl {
    position: relative;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetTrigger {
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 0 40px 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetTrigger:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: #ffffff;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetTrigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.wheel-settings-modal .wheel-settings__presetTrigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-secondary, #475569);
    border-bottom: 2px solid var(--text-secondary, #475569);
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetControl.is-open .wheel-settings__presetTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.wheel-settings-modal .wheel-settings__presetDropdown {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10050;
    display: grid;
    grid-template-columns: 76px 42px;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.custom-modal.wheel-settings-modal .wheel-settings__presetDropdown[hidden] {
    display: none !important;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetOptions {
    display: grid;
    gap: 10px;
    padding-right: 12px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}

.custom-modal.wheel-settings-modal .wheel-settings__presetOption {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetOption:hover,
.custom-modal.wheel-settings-modal .wheel-settings__presetOption:focus-visible {
    border-color: var(--border-strong, #cbd5e1);
    background: #ffffff;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.wheel-settings-modal .wheel-settings__presetSliderCol {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.custom-modal.wheel-settings-modal .wheel-settings__presetSlider {
    width: 18px;
    height: 156px;
    min-height: 156px;
    padding: 0;
    accent-color: var(--accent-primary, #2563eb);
    writing-mode: vertical-lr;
}

.custom-modal.wheel-settings-modal .wheel-settings__bulk {
    min-height: 76px;
}

.custom-modal.wheel-settings-modal .wheel-settings__softAction {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__softAction:hover,
.custom-modal.wheel-settings-modal .wheel-settings__softAction:focus-visible {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__itemsHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__addActions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tile {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.wheel-settings-modal .wheel-settings__tileTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tileNumber {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.custom-modal.wheel-settings-modal .wheel-settings__tileActions {
    display: inline-flex;
    gap: 6px;
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction:hover,
.custom-modal.wheel-settings-modal .wheel-settings__iconAction:focus-visible {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction--danger {
    border-color: rgba(239, 68, 68, 0.28);
    background: var(--danger-bg, #fff1f2);
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.wheel-settings-modal [data-wheel-action="up"] img {
    transform: rotate(180deg);
}

.custom-modal.wheel-settings-modal .wheel-settings__tileGrid--single {
    grid-template-columns: 1fr;
}

.custom-modal.wheel-settings-modal .wheel-settings__stickerPreview {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.custom-modal.wheel-settings-modal .wheel-settings__stickerPreviewBox {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
}

.custom-modal.wheel-settings-modal .wheel-settings__stickerPreviewBox img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.custom-modal.wheel-settings-modal .wheel-settings__stickerPreviewBox span {
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorRow {
    display: flex;
    align-items: center;
    min-height: 46px;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorButton,
.custom-modal.wheel-settings-modal .wheel-settings__paletteColor {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorButton:hover,
.custom-modal.wheel-settings-modal .wheel-settings__paletteColor:hover {
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteColor {
    position: relative;
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteColor span {
    position: absolute;
    right: 6px;
    bottom: 5px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.42);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleText {
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleTrack {
    position: relative;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleTrack::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transform: translateY(-50%);
    transition: left 0.18s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:checked + .wheel-settings__toggleTrack {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:checked + .wheel-settings__toggleTrack::after {
    left: 21px;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:focus-visible + .wheel-settings__toggleTrack {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .custom-modal.wheel-settings-modal {
        width: min(94vw, 560px);
        min-width: min(94vw, 560px);
        flex-direction: column;
    }

    .custom-modal.wheel-settings-modal .custom-modal-title {
        width: 100%;
        padding: 18px 20px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.wheel-settings-modal .custom-modal-content {
        max-height: none;
        border-top-right-radius: 0;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__preview {
        min-height: 0;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__previewCard {
        width: 96px;
        height: 96px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__head {
        padding-right: 44px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__body {
        max-height: none;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__fieldPair,
    .custom-modal.wheel-settings-modal .wheel-settings__fieldColumns,
    .custom-modal.wheel-settings-modal .wheel-settings__tileGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__itemsHead {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Tablet and below: label above control instead of the two-column row grid. */
@media (max-width: 700px) {
    .custom-modal.crossword-settings-modal .crossword-settings__row {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 6px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__row--nav .crossword-settings__label {
        padding-top: 0;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__control--narrow {
        max-width: 220px;
    }
}

/* Narrow: full-bleed dialog, stacked navigation, full-width footer buttons.
   560px is the breakpoint modal.css already uses for stacked modal footers
   (trial-booking-confirmation-modal, direct-payment-confirmation-modal). */
@media (max-width: 560px) {
    .custom-modal-overlay:has(.custom-modal.crossword-settings-modal) {
        padding: 12px;
    }

    .custom-modal.crossword-settings-modal {
        width: 100%;
        max-height: calc(100dvh - 24px);
        border-radius: var(--radius-lg);
    }

    .custom-modal.crossword-settings-modal .custom-modal-title {
        padding: 16px 16px 14px;
    }

    .custom-modal.crossword-settings-modal .custom-modal-body {
        padding: 2px 16px 8px;
    }

    .custom-modal.crossword-settings-modal .custom-modal-buttons {
        padding: 12px 16px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__heading {
        font-size: var(--app-theme-font-size-lg, 17px);
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navGroup {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navButton {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        min-height: 46px;
        padding: 8px 12px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navLabel {
        text-align: left;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__numberingContent {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__autoNumber {
        width: 100%;
    }

    .custom-modal.crossword-settings-modal .custom-modal-buttons {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .custom-modal.crossword-settings-modal .custom-modal-buttons .btn-cancel,
    .custom-modal.crossword-settings-modal .custom-modal-buttons .btn-ok {
        width: 100%;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__control--narrow {
        max-width: none;
    }
}

.custom-modal.puzzle-settings-modal {
    width: min(880px, 94vw);
    min-width: min(720px, 94vw);
    overflow: visible;
}

.custom-modal-overlay:has(.custom-modal.puzzle-settings-modal) {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 20px;
}

.custom-modal.puzzle-settings-modal .custom-modal-title {
    width: 120px;
    padding: 20px 18px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}

.custom-modal.puzzle-settings-modal .custom-modal-content {
    padding: 0;
    overflow: visible;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
}

.custom-modal.puzzle-settings-modal .custom-modal-body {
    padding: 20px 24px 18px;
    gap: 18px;
    overflow: visible;
}

.custom-modal.puzzle-settings-modal .custom-modal-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
    border-bottom-right-radius: 22px;
}

.custom-modal.puzzle-settings-modal .custom-modal-buttons button {
    min-width: 120px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

.custom-modal.puzzle-settings-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
    background: #f3f4f6;
    color: var(--text-secondary, #475569);
}

.custom-modal.puzzle-settings-modal .btn-cancel:hover {
    background: #e9edf2;
}

.custom-modal.puzzle-settings-modal .btn-ok {
    background: #4caf50;
    color: #ffffff;
}

.custom-modal.puzzle-settings-modal .btn-ok:hover {
    background: #45a049;
}

.custom-modal.puzzle-settings-modal .btn-ok:disabled {
    background: #9bd09e;
    cursor: not-allowed;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__rail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 220px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__railCard {
    width: 84px;
    height: 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    background:
        radial-gradient(circle at 22% 20%, rgba(191, 219, 254, 0.95), rgba(191, 219, 254, 0) 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__railCard img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-right: 52px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__headerText {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__title {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__subtitle {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    line-height: 1.55;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__headerActions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone {
    position: relative;
    min-height: 280px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 246, 255, 0.88));
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:hover,
.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone.is-dragover {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone.is-filled {
    border-style: solid;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.82;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmptyTitle {
    color: var(--text-primary, #0f172a);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmptyHint {
    color: var(--text-secondary, #64748b);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewMedia {
    position: relative;
    display: inline-grid;
    place-items: stretch;
    align-self: center;
    justify-self: center;
    width: fit-content;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewMedia[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewImage {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 360px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
    background:
        linear-gradient(45deg, rgba(226, 232, 240, 0.8) 25%, transparent 25%) -12px 0/24px 24px,
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.8) 75%) -12px 0/24px 24px,
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.8) 75%) 0 0/24px 24px,
        linear-gradient(45deg, rgba(226, 232, 240, 0.8) 25%, transparent 25%) 0 0/24px 24px,
        #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewGrid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
        linear-gradient(to right, rgba(15, 23, 42, 0.52) 3px, transparent 3px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.52) 3px, transparent 3px);
    background-size:
        calc(100% / var(--puzzle-grid-cols, 3)) 100%,
        100% calc(100% / var(--puzzle-grid-rows, 3)),
        calc(100% / var(--puzzle-grid-cols, 3)) 100%,
        100% calc(100% / var(--puzzle-grid-rows, 3));
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.45),
        inset 0 0 0 3px rgba(15, 23, 42, 0.20),
        inset 0 0 28px rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewGrid[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty .puzzle-settings__previewReplace {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace--overlay {
    position: absolute;
    right: 14px;
    bottom: 14px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:not(.is-filled) .puzzle-settings__previewReplace--overlay {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetControl {
    position: relative;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 0 38px 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger:hover {
    border-color: #cbd5e1;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetControl.is-open .puzzle-settings__presetTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 74px 40px;
    gap: 12px;
    width: auto;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetList {
    display: grid;
    gap: 10px;
    padding-right: 12px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetSliderCol {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 302px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetSlider {
    width: 18px;
    height: 156px;
    min-height: 156px;
    writing-mode: vertical-lr;
    direction: rtl;
    transform: rotate(180deg);
    accent-color: var(--accent-primary, #2563eb);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggle {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:hover + .puzzle-settings__toggleTrack {
    border-color: #cbd5e1;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:focus-visible + .puzzle-settings__toggleTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:checked + .puzzle-settings__toggleTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:checked + .puzzle-settings__toggleTrack::after {
    transform: translateX(18px);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft,
.custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
    justify-content: flex-end;
    margin-left: auto;
}

@media (max-width: 860px) {
    .custom-modal.puzzle-settings-modal {
        min-width: 0;
        width: min(96vw, 720px);
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__metrics {
        grid-template-columns: 1fr;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__toggles {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .custom-modal.puzzle-settings-modal {
        flex-direction: column;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-title {
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__rail {
        min-height: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__railCard {
        width: 72px;
        height: 72px;
        padding: 14px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__header {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__headerActions {
        justify-content: flex-start;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-body {
        padding: 16px 16px 14px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__previewZone {
        min-height: 220px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu {
        left: 0;
        min-width: 0;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-buttons {
        padding: 14px 16px 16px;
        flex-direction: column;
        align-items: stretch;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft,
    .custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
        width: 100%;
        margin-left: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft button,
    .custom-modal.puzzle-settings-modal .puzzle-settings__footerRight button {
        width: 100%;
    }
}

/* ===== Toast (non-blocking) ===== */
.toast-root {
    position: fixed;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2147483647;
    pointer-events: none;
}
.toast {
    pointer-events: none;
    min-width: 220px;
    max-width: 360px;
    font-family: var(--app-theme-font-family, inherit);
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #111827);
    border: 1px solid var(--border-default, rgba(15, 23, 42, 0.12));
    border-radius: var(--radius-md, 12px);
    padding: 10px 12px;
    box-shadow: var(--shadow-lg, 0 18px 44px rgba(15, 23, 42, 0.18));
    transform: translateY(0);
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.toast--interactive {
    pointer-events: auto;
}
.toast.toast-info {
    background: color-mix(in srgb, var(--accent-soft, #fff3ed) 52%, var(--bg-panel, #ffffff));
    border-color: color-mix(in srgb, var(--accent-primary, #f26b2d) 34%, var(--border-default, rgba(15, 23, 42, 0.12)));
}
.toast.toast-hide {
    opacity: 0;
    transform: translateY(8px);
}
.toast-message {
    color: var(--text-primary, #111827);
    font-size: var(--app-theme-font-size-tooltip, var(--app-theme-font-size-sm, 14px));
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-line;
}
.toast-message a {
    color: var(--accent-primary, #f26b2d);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.toast-message a:hover,
.toast-message a:focus {
    color: var(--accent-primary-hover, #d85b24);
}

/* ===== Local picker modal ===== */
.custom-modal.local-picker-modal {
    max-width: 720px;
    width: 92vw;
}

/* ===== Schedule: teacher prompt (T - 3 min) ===== */
.custom-modal-overlay:has(.custom-modal.schedule-3m-modal) {
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.custom-modal.schedule-3m-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.schedule-3m-modal.is-draggable .custom-modal-title {
    cursor: grab;
}

.custom-modal.schedule-3m-modal.is-draggable .custom-modal-content {
    cursor: default;
}

body.modal-dragging .custom-modal.schedule-3m-modal.is-draggable .custom-modal-title {
    cursor: grabbing;
}

.custom-modal.schedule-3m-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.custom-modal.schedule-3m-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
    color: #2563eb;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__heading {
    min-width: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
}

.custom-modal.schedule-3m-modal .custom-modal-close {
    display: none;
}

.custom-modal.schedule-3m-modal .custom-modal-body {
    gap: 12px;
}

.custom-modal.schedule-3m-modal .custom-modal-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: #475569;
}

.custom-modal.schedule-3m-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.schedule-3m-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.schedule-3m-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.schedule-3m-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-3m-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.schedule-3m-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.schedule-3m-modal {
        width: min(96vw, 520px);
        min-width: 0;
    }

    .custom-modal.schedule-3m-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.schedule-3m-modal .custom-modal-content {
        padding: 12px 18px 18px;
    }

    .custom-modal.schedule-3m-modal .custom-modal-buttons {
        flex-direction: column;
    }

    .custom-modal.schedule-3m-modal .custom-modal-buttons button {
        width: 100%;
    }
}

/* ===== Schedule: booking confirm ===== */
.custom-modal-overlay:has(.custom-modal.schedule-booking-modal) {
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.custom-modal.schedule-booking-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.schedule-booking-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.schedule-booking-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.schedule-booking-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.schedule-booking-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.schedule-booking-modal .custom-modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-booking-modal .custom-modal-close:hover img {
    transform: rotate(90deg);
}

.custom-modal.schedule-booking-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__title-copy {
    min-width: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
}

.custom-modal.schedule-booking-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.schedule-booking-modal .custom-modal-body p {
    display: grid;
    gap: 12px;
    margin: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__meta {
    display: grid;
    gap: 12px;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    background: #fff;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__value {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
    text-align: right;
}

.custom-modal.schedule-booking-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.schedule-booking-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.schedule-booking-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.schedule-booking-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-booking-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.schedule-booking-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.custom-modal.billing-limit-modal .btn-ok {
    background: var(--accent-primary, #7c3aed);
    border-color: var(--accent-primary, #7c3aed);
    color: var(--text-on-accent, #ffffff);
}

.custom-modal.billing-limit-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #6d28d9);
    border-color: var(--accent-primary-hover, #6d28d9);
}

.custom-modal.release-manual-modal {
    width: min(720px, 92vw);
    min-width: min(560px, 92vw);
    max-width: 92vw;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.release-manual-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.release-manual-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 16px;
    position: static;
}

.custom-modal.release-manual-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-secondary, #667085);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.release-manual-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.release-manual-modal .custom-modal-close:hover {
    background: var(--accent-soft, #eff6ff);
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.custom-modal.release-manual-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.release-manual-modal .release-manual-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.custom-modal.release-manual-modal .release-manual-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.release-manual-modal .release-manual-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.release-manual-modal .release-manual-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.release-manual-modal .release-manual-modal__eyebrow {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary, #667085);
}

.custom-modal.release-manual-modal .release-manual-modal__headline {
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
}

.custom-modal.release-manual-modal .custom-modal-body {
    gap: 14px;
}

.custom-modal.release-manual-modal .custom-modal-body p {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.custom-modal.release-manual-modal .release-manual-modal__lead {
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.custom-modal.release-manual-modal .release-manual-modal__note {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary, #667085);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput {
    min-height: 220px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    line-height: 1.55;
    resize: vertical;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput::placeholder {
    color: var(--text-muted, #98a2b3);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput:hover {
    border-color: var(--border-strong, #cbd5e1);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput:focus {
    outline: 2px solid rgba(37, 99, 235, 0.14);
    outline-offset: 1px;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.release-manual-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.release-manual-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.release-manual-modal .btn-cancel {
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #334155);
    border-color: var(--border-default, #dbe5f0);
}

.custom-modal.release-manual-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: var(--border-strong, #cbd5e1);
}

.custom-modal.release-manual-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.release-manual-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 640px) {
    .custom-modal.release-manual-modal {
        min-width: 0;
        width: min(92vw, 560px);
    }

    .custom-modal.release-manual-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.release-manual-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__header {
        align-items: flex-start;
    }

    .custom-modal.release-manual-modal .release-manual-modal__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__icon img {
        width: 28px;
        height: 28px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__headline {
        font-size: 18px;
    }

    .custom-modal.release-manual-modal .custom-modal-buttons {
        flex-direction: column-reverse;
    }

    .custom-modal.release-manual-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.schedule-no-lessons-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.schedule-no-lessons-modal .custom-modal-body p {
    margin: 0;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__body {
    display: block;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__notice {
    display: block;
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    background: #fff;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__text {
    display: block;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
    color: #334155;
}

.custom-modal.quick-messages-modal {
    width: min(680px, 92vw);
    min-width: 0;
    max-width: 92vw;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.quick-messages-modal .custom-modal-content {
    position: relative;
    padding: 20px;
    gap: 16px;
}

.custom-modal.quick-messages-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.custom-modal.quick-messages-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.quick-messages-modal .custom-modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.quick-messages-modal .custom-modal-close:hover img {
    transform: rotate(90deg);
}

.custom-modal.quick-messages-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.quick-messages__header {
    padding-right: 56px;
}

.quick-messages__title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 800;
    color: #0f172a;
}

.custom-modal.quick-messages-modal .custom-modal-body.quick-messages__body {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.quick-messages__avatar {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.quick-messages__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.quick-messages__avatar-fallback {
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    color: #334155;
}

.quick-messages__form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.quick-messages__presence {
    min-height: 20px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    color: #64748b;
}

.quick-messages__presence.is-online {
    color: #15803d;
}

.quick-messages__input {
    width: 100%;
    min-height: 168px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #dbe4ee;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.quick-messages__input::placeholder {
    color: #94a3b8;
}

.quick-messages__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.custom-modal.quick-messages-modal .custom-modal-buttons.quick-messages__footer {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
}

.custom-modal.quick-messages-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.quick-messages-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.quick-messages-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.quick-messages-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.quick-messages-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.custom-modal.quick-messages-modal .btn-ok:disabled {
    opacity: 0.55;
    cursor: default;
}

@media (max-width: 640px) {
    .custom-modal.quick-messages-modal .custom-modal-content {
        padding: 18px;
    }

    .custom-modal.quick-messages-modal .custom-modal-body.quick-messages__body {
        grid-template-columns: 1fr;
    }

    .quick-messages__avatar {
        width: 64px;
        height: 64px;
    }

    .custom-modal.quick-messages-modal .custom-modal-buttons.quick-messages__footer {
        flex-direction: column;
    }

    .custom-modal.quick-messages-modal .custom-modal-buttons button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .custom-modal.schedule-booking-modal {
        width: min(96vw, 520px);
        min-width: 0;
    }

    .custom-modal.schedule-booking-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.schedule-booking-modal .custom-modal-content {
        padding: 12px 18px 18px;
    }

    .custom-modal.schedule-booking-modal .schedule-booking-modal__row {
        grid-template-columns: 1fr;
        display: grid;
        gap: 6px;
    }

    .custom-modal.schedule-booking-modal .schedule-booking-modal__value {
        text-align: left;
    }

    .custom-modal.schedule-booking-modal .custom-modal-buttons {
        flex-direction: column;
    }

    .custom-modal.schedule-booking-modal .custom-modal-buttons button {
        width: 100%;
    }

    .custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__notice {
        padding: 14px;
    }
}

.custom-modal-overlay:has(.custom-modal.lessons-guest-link-modal) {
    background: rgba(15, 23, 42, 0.42);
}

.custom-modal.lessons-guest-link-modal {
    width: min(660px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.custom-modal.lessons-guest-link-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid rgba(226, 232, 240, 0.96);
}

.custom-modal.lessons-guest-link-modal .custom-modal-title img {
    width: 48px;
    height: 48px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.custom-modal.lessons-guest-link-modal .custom-modal-content {
    padding: 20px 20px 18px;
    gap: 18px;
    position: static;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:hover img,
.custom-modal.lessons-guest-link-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.lessons-guest-link-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.lessons-guest-link-modal .custom-modal-body p {
    margin: 0;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__meta {
    display: inline-flex;
    align-self: flex-start;
    padding: 8px 12px;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 999px;
    background: rgba(239, 246, 255, 0.9);
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link-label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link {
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    line-height: 1.45;
    word-break: break-all;
    user-select: text;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__hint {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.lessons-guest-link-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.lessons-guest-link-modal .custom-modal-buttons button {
    min-width: 112px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.lessons-guest-link-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
}

.custom-modal.lessons-guest-link-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 640px) {
    .custom-modal.lessons-guest-link-modal {
        min-width: 0;
        width: min(96vw, 420px);
        flex-direction: column;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-title {
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid rgba(226, 232, 240, 0.96);
        justify-content: flex-start;
        align-items: center;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-content {
        padding: 16px 16px 16px;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.local-picker-modal .custom-modal-title {
    max-width: 45%;
}
.local-picker__title {
    font-size: var(--app-theme-font-size-lg, 17px);
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}
.local-picker__subtitle {
    font-size: var(--app-theme-font-size-sm, 14px);
    color: var(--text-secondary, #64748b);
    margin-top: -4px;
}
.local-picker__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 56vh;
    overflow: auto;
    padding-right: 4px;
}
.local-picker__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    border-radius: var(--radius-sm, 10px);
    padding: 10px 12px;
    cursor: pointer;
}
.local-picker__item:hover {
    background: var(--accent-soft, #fdece0);
    border-color: var(--accent-primary, #e66a2c);
}
.local-picker__item-title {
    font-size: var(--app-theme-font-size-md, 15px);
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}
.local-picker__item-tags {
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-secondary, #64748b);
    width: 100%;
    text-align: right;
}
.local-picker__empty {
    font-size: var(--app-theme-font-size-sm, 14px);
    color: var(--text-muted, #94a3b8);
    padding: 10px 4px;
}
.local-picker__loading {
    color: var(--text-secondary, #64748b);
    font-weight: 700;
}
.custom-modal.sticker-settings-modal .sticker-chip .x {
    opacity: 0.7;
    font-weight: 700;
}
.custom-modal.sticker-settings-modal .sticker-chip:hover {
    background: #e3ebff;
}

/* ===== Create card from sticker modal ===== */
.custom-modal.create-card-from-sticker-modal {
    max-width: 860px;
    width: 92vw;
    background: var(--bg-panel, #ffffff);
    border-color: var(--border-default, #dbe5f0);
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
}
.custom-modal.create-card-from-sticker-modal .custom-modal-close {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: var(--radius-sm, 10px);
    background: var(--bg-panel, #ffffff);
    color: var(--text-secondary, #64748b);
    padding: 0;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.custom-modal.create-card-from-sticker-modal .custom-modal-close__icon {
    width: 20px;
    height: 20px;
    display: block;
    background: currentColor;
    -webkit-mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
    mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
    transition: transform 0.18s ease;
}
.custom-modal.create-card-from-sticker-modal .custom-modal-close:hover,
.custom-modal.create-card-from-sticker-modal .custom-modal-close:focus-visible {
    background: var(--accent-soft, #fdece0);
    border-color: var(--accent-primary, #e66a2c);
    color: var(--accent-primary, #e66a2c);
}
.custom-modal.create-card-from-sticker-modal .custom-modal-close:hover .custom-modal-close__icon,
.custom-modal.create-card-from-sticker-modal .custom-modal-close:focus-visible .custom-modal-close__icon {
    transform: rotate(90deg);
}
.custom-modal.create-card-from-sticker-modal .custom-modal-close:focus-visible {
    outline: 2px solid var(--accent-primary, #e66a2c);
    outline-offset: 2px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-title {
    font-size: var(--app-theme-font-size-title-base, 18px);
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    margin-bottom: 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-queuebar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-remaining {
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-secondary, #64748b);
    font-weight: 700;
}
.custom-modal.create-card-from-sticker-modal .ccfs-same {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-primary, #0f172a);
    font-weight: 700;
    user-select: none;
}
.custom-modal.create-card-from-sticker-modal .ccfs-same input {
    width: 16px;
    height: 16px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: end;
}
.custom-modal.create-card-from-sticker-modal .ccfs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-label {
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-secondary, #64748b);
    font-weight: 700;
}
.custom-modal.create-card-from-sticker-modal .ccfs-section-title {
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-secondary, #64748b);
    font-weight: 800;
    margin: 12px 0 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-rows,
.custom-modal.create-card-from-sticker-modal .ccfs-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-row {
    display: grid;
    grid-template-columns: 18px 22px 44px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-panel, #ffffff);
}
.custom-modal.create-card-from-sticker-modal .ccfs-row:hover {
    border-color: var(--accent-primary, #e66a2c);
    background: var(--accent-soft, #fdece0);
}
.custom-modal.create-card-from-sticker-modal .ccfs-radio {
    width: 18px;
    height: 18px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--border-default, #dbe5f0);
}
.custom-modal.create-card-from-sticker-modal .ccfs-lang {
    font-size: var(--app-theme-font-size-xs, 13px);
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    letter-spacing: 0.3px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-row-custom {
    grid-template-columns: 18px 18px 140px 1fr 92px 120px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-icon {
    font-size: var(--app-theme-font-size-sm, 14px);
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-label {
    font-size: var(--app-theme-font-size-xs, 13px);
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-lang {
    min-width: 88px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn {
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    padding: 8px 10px;
    background: var(--bg-muted, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-family: var(--app-theme-font-family, inherit);
    font-size: var(--app-theme-font-size-xs, 13px);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.18s, border-color 0.18s;
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn:hover {
    background: var(--accent-soft, #fdece0);
    border-color: var(--accent-primary, #e66a2c);
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.custom-modal.create-card-from-sticker-modal .custom-modal-buttons.ccfs-footer {
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.custom-modal.create-card-from-sticker-modal .ccfs-footer-left {
    flex: 1 1 320px;
    min-width: 240px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-footer-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.custom-modal.create-card-from-sticker-modal .ccfs-audio-note {
    font-size: var(--app-theme-font-size-xs, 13px);
    color: var(--text-secondary, #64748b);
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-muted, #f8fafc);
}
@media (max-width: 680px) {
    .custom-modal.create-card-from-sticker-modal .ccfs-grid {
        grid-template-columns: 1fr;
    }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom {
        grid-template-columns: 18px 18px 1fr;
        grid-template-areas:
            "radio icon label"
            "radio . input"
            "radio . lang"
            "radio . btn";
    }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-radio { grid-area: radio; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-icon { grid-area: icon; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-label { grid-area: label; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-word { grid-area: input; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-lang { grid-area: lang; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-translate-btn { grid-area: btn; }
}

/* --- Link preview modal --- */
.custom-modal.link-preview-modal .link-preview-block {
  margin-top: 2px;
  border-top: 1px solid var(--border-default, #dbe5f0);
  padding-top: 14px;
}

.custom-modal.link-preview-modal .link-preview-block__label {
  margin-bottom: 8px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.custom-modal.link-preview-modal .link-preview-block__hint,
.custom-modal.link-preview-modal .link-preview-block__loading,
.custom-modal.link-preview-modal .link-preview-block__error {
  padding: 12px 14px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: 10px;
  background: var(--bg-app, #f8fafc);
  color: var(--text-secondary, #475569);
  font-size: 13px;
  line-height: 1.45;
}

.custom-modal.link-preview-modal .link-preview-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: 12px;
  background: #ffffff;
}

.custom-modal.link-preview-modal .link-preview-card__image {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--bg-app, #f8fafc);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal.link-preview-modal .link-preview-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.custom-modal.link-preview-modal .link-preview-card__placeholder {
  color: var(--text-secondary, #475569);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.custom-modal.link-preview-modal .link-preview-card__title {
  color: var(--text-primary, #0f172a);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
}

.custom-modal.link-preview-modal .link-preview-card__domain {
  margin-top: 2px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  line-height: 1.35;
}

.custom-modal.link-preview-modal .link-preview-card__desc {
  margin-top: 4px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  line-height: 1.45;
  max-height: 2.9em;
  overflow: hidden;
}

/* --- Card settings modal --- */
.custom-modal.card-settings-modal {
  width: min(620px, 94vw);
  min-width: min(540px, 94vw);
}

.custom-modal.card-settings-modal .custom-modal-title {
  align-items: stretch;
  justify-content: center;
  padding: 22px 14px;
}

.custom-modal.card-settings-modal .custom-modal-content {
  padding: 20px 20px 18px;
}

.custom-modal.card-settings-modal .custom-modal-body {
  gap: 14px;
}

.custom-modal.card-settings-modal .custom-modal-body > h3 {
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__preview-stack {
  position: relative;
  width: 100%;
  min-height: 170px;
  height: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-group {
  display: block;
}

.custom-modal.card-settings-modal .card-settings__preview-card {
  width: 60px;
  height: 90px;
  border-radius: 14px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-single .card-settings__preview-card {
  width: 72px;
  height: 108px;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-group .card-settings__preview-card {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.custom-modal.card-settings-modal .card-settings__preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

.custom-modal.card-settings-modal .card-settings__size-section {
  margin-top: 2px;
}

.custom-modal.card-settings-modal .card-settings__size-title,
.custom-modal.card-settings-modal .card-settings__section-title {
  margin: 0 0 8px;
  color: var(--text-secondary, #475569);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.custom-modal.card-settings-modal .card-settings__size-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.custom-modal.card-settings-modal .card-settings__section {
  margin-top: 0;
}

.custom-modal.card-settings-modal .card-settings__radio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.custom-modal.card-settings-modal .card-settings__image-fit-grid {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 220px;
}

.custom-modal.card-settings-modal .card-settings__hint {
  margin-top: 8px;
  color: var(--text-muted, #94a3b8);
  font-size: var(--app-theme-font-size-sm, 13px);
  font-weight: 600;
  line-height: 1.35;
}

.custom-modal.card-settings-modal .card-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s;
}

.custom-modal.card-settings-modal .card-radio--compact {
  padding: 9px 10px;
}

.custom-modal.card-settings-modal .card-radio:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.custom-modal.card-settings-modal .card-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.custom-modal.card-settings-modal .card-radio__label {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
}

.custom-modal.card-settings-modal .card-settings__size-grid .card-radio input:checked + .card-radio__label {
  font-size: x-large;
}

.custom-modal.card-settings-modal .card-settings__sep {
  height: 1px;
  background: #edf2f7;
  margin: 2px 0;
}

.custom-modal.card-settings-modal .card-settings__select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
}

.custom-modal.card-settings-modal .card-settings__select-label {
  font-size: 13px;
  color: #475569;
  font-weight: 700;
}

.custom-modal.card-settings-modal .card-settings__select {
  width: 100%;
  max-width: 260px;
}

.modal-custom-select {
  position: relative;
  font-family: var(--app-theme-font-family, inherit);
}

.modal-custom-select__trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.modal-custom-select__trigger:hover,
.modal-custom-select__trigger:focus-visible,
.modal-custom-select.is-open .modal-custom-select__trigger {
  outline: none;
  border-color: var(--accent-primary, #2f6fe4);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #2f6fe4) 14%, transparent);
}

.modal-custom-select.is-disabled .modal-custom-select__trigger,
.modal-custom-select__trigger:disabled {
  cursor: not-allowed;
  opacity: .6;
}

.modal-custom-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.modal-custom-select__chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  transition: transform .16s ease;
}

.modal-custom-select.is-open .modal-custom-select__chevron {
  transform: rotate(180deg);
}

.modal-custom-select__menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--accent-primary, #2f6fe4);
  border-radius: var(--radius-md, 14px);
  background: var(--bg-panel, #ffffff);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .18);
  overflow: auto;
  z-index: 10060;
  box-sizing: border-box;
}

.modal-custom-select__menu--portal {
  position: fixed;
}

.modal-custom-select__menu[hidden] {
  display: none;
}

.modal-custom-select__option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.modal-custom-select__option:hover,
.modal-custom-select__option:focus-visible,
.modal-custom-select__option.is-selected {
  outline: none;
  border-color: var(--accent-primary, #2f6fe4);
  background: var(--accent-soft, #e3edff);
  color: var(--accent-primary, #2f6fe4);
}

.modal-custom-select__option.is-selected {
  font-weight: 800;
}

.custom-modal.card-settings-modal .card-settings__checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__checkbox input[type="checkbox"] {
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.custom-modal.card-settings-modal .card-settings__checkbox-label img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

@media (max-width: 720px) {
  .custom-modal.card-settings-modal {
    min-width: 0;
    width: min(96vw, 560px);
  }

  .custom-modal.card-settings-modal .custom-modal-title {
    width: 100%;
    min-height: 108px;
    border-right: none;
    border-bottom: 1px solid var(--border-default, #dbe5f0);
  }

  .custom-modal.card-settings-modal .card-settings__preview-stack {
    min-height: 72px;
  }

  .custom-modal.card-settings-modal .card-settings__preview-card {
    width: 52px;
    height: 78px;
  }
}

.student-modal__input-wrap {
  position: relative;
  width: 100%;
}

.student-modal__input-wrap .student-modal__input {
  padding-right: 40px;
}

.student-modal__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.student-modal__toggle img {
  width: 20px;
  height: 20px;
  display: block;
  margin: 0;
  opacity: 0.8;
}

.student-modal__toggle:hover img {
  opacity: 1;
}

.student-modal__toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Student modal theme layer. */
:root.app-theme .student-modal-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 45%, transparent);
}

:root.app-theme .student-modal {
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 20%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .student-modal__header,
:root.app-theme .student-modal__footer {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .student-modal__title {
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-title, 20px);
}

:root.app-theme .student-modal__label,
:root.app-theme .student-avatar-text,
:root.app-theme .student-avatar-sub {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .student-modal__label,
:root.app-theme .student-avatar-text,
:root.app-theme .student-modal__error {
  font-size: var(--app-theme-font-size-xs, 13px);
}

:root.app-theme .student-avatar-sub,
:root.app-theme .student-avatar-error {
  font-size: var(--app-theme-font-size-xs, 13px);
}

:root.app-theme .student-modal__input,
:root.app-theme .student-modal__actions .btn {
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .student-modal__input {
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-primary, #0f172a);
}

:root.app-theme .student-modal__input:focus {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
}

:root.app-theme .student-avatar-drop,
:root.app-theme .student-avatar-preview {
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
}

:root.app-theme .student-avatar-drop.dragover,
:root.app-theme .student-avatar-drop:focus-visible {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
}

:root.app-theme .student-avatar-fallback {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .student-avatar-error,
:root.app-theme .student-modal__error {
  color: var(--danger, #b91c1c);
}

:root.app-theme .student-modal__close,
:root.app-theme .student-modal__toggle,
:root.app-theme .student-modal__actions .btn {
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
  color: var(--text-primary, #0f172a);
}

:root.app-theme .student-modal__close:hover,
:root.app-theme .student-modal__close:focus-visible,
:root.app-theme .student-modal__toggle:hover,
:root.app-theme .student-modal__toggle:focus-visible,
:root.app-theme .student-modal__actions .btn:hover,
:root.app-theme .student-modal__actions .btn:focus-visible {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .student-modal__close:focus-visible,
:root.app-theme .student-modal__toggle:focus-visible,
:root.app-theme .student-modal__actions .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-primary, #e66a2c) 35%, transparent);
  outline-offset: 2px;
}

:root.app-theme .student-modal__toggle {
  border: 1px solid transparent;
}

:root.app-theme .student-modal__actions .btn {
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--text-primary, #0f172a) 8%, transparent);
}

:root.app-theme .student-modal__actions .btn.primary {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #ffffff);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent-primary, #e66a2c) 25%, transparent);
}

:root.app-theme .student-modal__actions .btn.primary:hover,
:root.app-theme .student-modal__actions .btn.primary:focus-visible {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
  color: var(--text-on-accent, #ffffff);
}

/* Final shared custom modal theme layer.
   Keep it after legacy modal variants so regular custom modals, including contacts, follow app_theme.css. */
:root.app-theme .custom-modal-overlay {
  background: color-mix(in srgb, var(--text-primary, #0f172a) 46%, transparent);
}

:root.app-theme .custom-modal:not(.board-editor-modal):not(.schedule-3m-modal):not(.schedule-booking-modal):not(.release-manual-modal):not(.quick-messages-modal):not(.lessons-guest-link-modal) {
  background: var(--bg-panel, #ffffff);
  border-color: var(--border-default, #dbe5f0);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal.card-dislike-modal {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
}

:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-secondary, #64748b);
  padding: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close__icon {
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  transition: transform 0.18s ease;
}

:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close:hover,
:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close:focus-visible {
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close:hover .custom-modal-close__icon,
:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close:focus-visible .custom-modal-close__icon {
  transform: rotate(90deg);
}

:root.app-theme .custom-modal.card-dislike-modal .custom-modal-close:focus-visible {
  outline: 2px solid var(--accent-primary, #e66a2c);
  outline-offset: 2px;
}

:root.app-theme .custom-modal.card-dislike-modal .card-dislike-modal__textarea {
  min-height: 110px;
  resize: vertical;
}

:root.app-theme .custom-modal.contacts-modal {
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-md, 14px);
}

:root.app-theme .custom-modal.contacts-modal .custom-modal-body p {
  color: var(--text-secondary, #64748b);
  font-size: var(--app-theme-font-size-md, 15px);
  line-height: 1.55;
}

:root.app-theme .custom-modal.contacts-modal .custom-modal-body strong {
  color: var(--text-primary, #0f172a);
}

:root.app-theme .custom-modal.contacts-modal .custom-modal-body a {
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.contacts-modal .btn-ok {
  background: var(--accent-primary, #e66a2c);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--text-on-accent, #fff);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal.contacts-modal .btn-ok:hover,
:root.app-theme .custom-modal.contacts-modal .btn-ok:focus-visible {
  background: var(--accent-primary-hover, #c9561f);
  border-color: var(--accent-primary-hover, #c9561f);
}

/* Local lesson picker modal theme layer. */
:root.app-theme .custom-modal.local-picker-modal {
  width: min(560px, 92vw);
  max-width: min(560px, 92vw);
  min-width: min(480px, 92vw);
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  gap: 0;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-lg, 18px);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text-primary, #0f172a) 18%, transparent);
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-title {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-height: 64px;
  padding: 16px 64px 14px 22px;
  border-bottom: 1px solid var(--border-default, #dbe5f0);
  background: var(--bg-muted, #f8fafc);
  color: var(--text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--app-theme-font-size-title, 20px);
  font-weight: 800;
  justify-content: flex-start;
  line-height: 1.2;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__title-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: block;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-content {
  position: static;
  padding: 18px 22px 20px;
  gap: 16px;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-close img {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-close::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  mask: url("/static/assets/icons/x.svg") center / contain no-repeat;
  transform-origin: center;
  transition: transform 0.18s ease;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-close:hover,
:root.app-theme .custom-modal.local-picker-modal .custom-modal-close:focus-visible {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-close:hover::before,
:root.app-theme .custom-modal.local-picker-modal .custom-modal-close:focus-visible::before {
  transform: rotate(90deg);
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-body {
  gap: 12px;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__subtitle {
  color: var(--text-secondary, #64748b);
  font-size: var(--app-theme-font-size-sm, 14px);
  line-height: 1.45;
  margin-top: 0;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__search {
  height: 44px;
  margin-bottom: 24px;
  padding: 10px 12px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__search::placeholder {
  color: var(--text-muted, #94a3b8);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__search:focus {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__list {
  gap: 8px;
  padding: 2px 4px 2px 0;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__item {
  border-color: var(--border-default, #dbe5f0);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__item:hover,
:root.app-theme .custom-modal.local-picker-modal .local-picker__item:focus-visible {
  outline: none;
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
  color: var(--accent-primary, #e66a2c);
  transform: translateY(-1px);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__item-title {
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__item:hover .local-picker__item-title,
:root.app-theme .custom-modal.local-picker-modal .local-picker__item:focus-visible .local-picker__item-title {
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__item-tags {
  color: var(--text-secondary, #64748b);
  font-size: var(--app-theme-font-size-xs, 13px);
  width: 100%;
  text-align: right;
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__empty {
  color: var(--text-muted, #94a3b8);
  font-size: var(--app-theme-font-size-sm, 14px);
}

:root.app-theme .custom-modal.local-picker-modal .local-picker__loading {
  color: var(--text-secondary, #64748b);
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-buttons {
  margin-top: 0;
  padding-top: 4px;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-buttons .btn-cancel {
  min-height: 40px;
  background: var(--bg-muted, #f8fafc);
  border-color: var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-primary, #0f172a);
  font-family: var(--app-theme-font-family, inherit);
  font-size: var(--app-theme-font-size-md, 15px);
  font-weight: 700;
}

:root.app-theme .custom-modal.local-picker-modal .custom-modal-buttons .btn-cancel:hover,
:root.app-theme .custom-modal.local-picker-modal .custom-modal-buttons .btn-cancel:focus-visible {
  outline: none;
  background: var(--accent-soft, #fdece0);
  border-color: var(--accent-primary, #e66a2c);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.local-picker-modal.homework-assignment-modal .local-picker__item.is-selected {
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
  color: var(--accent-primary, #e66a2c);
}

:root.app-theme .custom-modal.local-picker-modal.homework-assignment-modal .custom-modal-content {
  max-height: min(720px, calc(100vh - 64px));
}

:root.app-theme .custom-modal.local-picker-modal.homework-assignment-modal .custom-modal-body {
  overflow: hidden;
}

:root.app-theme .custom-modal.local-picker-modal.homework-assignment-modal .local-picker__list {
  max-height: min(430px, calc(100vh - 270px));
  overflow: auto;
}

:root.app-theme .homework-assignment-modal__step[hidden] {
  display: none;
}

:root.app-theme .homework-assignment-modal__settings {
  display: grid;
  gap: 12px;
}

:root.app-theme .homework-assignment-modal__selected {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-muted, #f8fafc);
  color: var(--text-secondary, #64748b);
  font: 700 var(--app-theme-font-size-sm, 14px) / 1.2 var(--app-theme-font-family, inherit);
}

:root.app-theme .homework-assignment-modal__selected-title {
  color: var(--text-primary, #0f172a);
  font-size: var(--app-theme-font-size-md, 15px);
}

:root.app-theme .homework-assignment-modal__field {
  display: grid;
  gap: 7px;
  color: var(--text-secondary, #64748b);
  font: 700 var(--app-theme-font-size-sm, 14px) / 1.25 var(--app-theme-font-family, inherit);
}

:root.app-theme .homework-assignment-modal__date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font: 700 var(--app-theme-font-size-md, 15px) / 1 var(--app-theme-font-family, inherit);
  cursor: pointer;
}

:root.app-theme .homework-assignment-modal__date:hover,
:root.app-theme .homework-assignment-modal__date:focus-visible {
  border-color: var(--accent-primary, #e66a2c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #e66a2c) 16%, transparent);
  outline: none;
}

:root.app-theme .homework-assignment-modal__date img {
  width: 20px;
  height: 20px;
}

:root.app-theme .homework-assignment-modal__segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

:root.app-theme .homework-assignment-modal__presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

:root.app-theme .homework-assignment-modal__segmented button,
:root.app-theme .homework-assignment-modal__presets button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-panel, #ffffff);
  color: var(--text-primary, #0f172a);
  font: 700 var(--app-theme-font-size-sm, 14px) / 1.15 var(--app-theme-font-family, inherit);
  cursor: pointer;
}

:root.app-theme .homework-assignment-modal__segmented button:hover,
:root.app-theme .homework-assignment-modal__segmented button:focus-visible,
:root.app-theme .homework-assignment-modal__segmented button.is-active,
:root.app-theme .homework-assignment-modal__presets button:hover,
:root.app-theme .homework-assignment-modal__presets button:focus-visible,
:root.app-theme .homework-assignment-modal__presets button.is-active {
  border-color: var(--accent-primary, #e66a2c);
  background: var(--accent-soft, #fdece0);
  color: var(--accent-primary, #e66a2c);
  outline: none;
}

:root.app-theme .homework-assignment-modal__oral {
  display: grid;
  gap: 12px;
}

:root.app-theme .homework-assignment-modal__oral[hidden] {
  display: none;
}

:root.app-theme .homework-assignment-modal__back[hidden] {
  display: none;
}
