* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
}

.main-container {
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
}

/* ===== КАРТОЧКА ===== */
.card {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-body {
    padding: 2rem;
}

/* ===== ЗАГОЛОВОК ===== */
.header-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header-title h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-title .gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-title p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ===== ФОРМА ВВОДА ===== */
.input-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.input-field {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 1rem;
    background: #ffffff;
    color: #1f2937;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.input-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.input-field::placeholder {
    color: #9ca3af;
}

.btn-primary {
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ===== НАСТРОЙКИ ===== */
.settings-group {
    margin-top: 1.25rem;
}

.settings-group + .settings-group {
    margin-top: 1rem;
}

.group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== ЧИПСЫ ===== */
.feature-chip {
    display: inline-flex;
    transition: transform 0.15s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.feature-chip:hover {
    transform: scale(1.04);
}

.feature-chip:active {
    transform: scale(0.95);
}

.feature-chip input {
    display: none;
}

.feature-chip label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
}

.feature-chip input:checked + label {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
    box-shadow: 0 0 0 2px #667eea;
}

/* ===== РАСШИРЕННЫЕ ПОЛЯ ===== */
.extent-field {
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0;
}

.extent-field.show {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.75rem;
    padding: 0.125rem 0;
}

.extent-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.extent-field .input-field {
    font-size: 0.875rem;
    padding: 0.6rem 0.875rem;
}

.extent-field .input-hint {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* ===== РЕДАКТОР В ГЛАВНОМ ОКНЕ ===== */
#editor {
    width: 100%;
    height: 200px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s ease;
    background: #ffffff;
}

#editor:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Адаптивность для редактора в главном окне */
@media (max-width: 768px) {
    #editor {
        height: 280px !important;
    }
}

@media (max-width: 480px) {
    #editor {
        height: 320px !important;
    }
}

.editormd {
    border: none !important;
}

.editormd .editormd-toolbar {
    border-radius: 0 !important;
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.editormd .editormd-edit-area {
    border: none !important;
}

/* ===== АККОРДЕОН ===== */
.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 0;
    margin-top: 0.75rem;
    background: none;
    border: none;
    border-top: 1px solid #f3f4f6;
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.accordion-toggle:hover {
    color: #374151;
}

.accordion-toggle .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.7rem;
}

.accordion-toggle .arrow.open {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.4s ease, padding 0.4s ease;
    opacity: 0;
    padding: 0;
}

.accordion-content.open {
    max-height: 1200px;
    opacity: 1;
    padding: 0.75rem 0 0.25rem 0;
}

.desc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
}

.desc-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    background: #fafafa;
    transition: background 0.2s ease;
    line-height: 1.4;
}

.desc-item:hover {
    background: #f3f4f6;
}

.desc-item .icon {
    flex-shrink: 0;
    font-size: 1rem;
    width: 1.4rem;
    text-align: center;
    margin-top: 0.05rem;
}

.desc-item .desc-text {
    font-size: 0.78rem;
    color: #4b5563;
    word-break: break-word;
}

.desc-item .desc-text .label {
    font-weight: 600;
    color: #1f2937;
}

.desc-item .desc-text .separator {
    color: #d1d5db;
    margin: 0 0.2rem;
}

/* ===== СТАТИСТИКА ===== */
.stats-text {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    line-height: 1.5;
    min-height: 2.5rem;
    transition: opacity 0.3s ease;
    cursor: pointer;
    position: relative;
}

.stats-text:hover {
    color: #667eea;
}

.stats-text .click-hint {
    display: block;
    font-size: 0.6rem;
    color: #9ca3af;
    margin-top: 0.15rem;
    opacity: 0.7;
}

.stats-text.loading {
    opacity: 0.5;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

/* ===== ИСПРАВЛЕНИЕ 1: адаптивная высота модального окна ===== */
.modal-box {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    max-width: 48rem;
    width: 100%;
    max-height: 85dvh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
/* ===== КОНЕЦ ИСПРАВЛЕНИЯ 1 ===== */

.modal-overlay.active .modal-box {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.modal-header .badge {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
}

.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    color: #4b5563;
}

.modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* ===== ИСПРАВЛЕНИЕ 1: адаптивная высота модального окна ===== */
#manageModal .modal-body {
    padding: 1.25rem 1.75rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#linksListContainer {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
/* ===== КОНЕЦ ИСПРАВЛЕНИЯ 1 ===== */

/* ===== ПОИСК ===== */
.search-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.search-row .input-field {
    flex: 1;
    font-size: 0.875rem;
    padding: 0.6rem 0.875rem;
}

.search-row .btn-secondary {
    flex-shrink: 0;
    background: #f3f4f6;
    color: #374151;
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
}

.search-row .btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* ===== СПИСОК ССЫЛОК ===== */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.link-item {
    border: 2px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, background 0.2s ease, opacity 0.25s ease, transform 0.25s ease;
    cursor: default;
    will-change: transform, opacity;
    flex-shrink: 0;
}

.link-item:hover {
    border-color: #e5e7eb;
    background: #fafafa;
}

.link-item.active {
    border-color: #667eea;
    background: #eef2ff;
}

.link-item .link-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.link-item .link-short {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
    word-break: break-all;
    flex: 1;
    min-width: 120px;
}

/* ===== ИСПРАВЛЕНИЕ 2: ограничение длинных ссылок двумя строками ===== */
.link-item .link-target {
    font-size: 0.8rem;
    color: #6b7280;
    word-break: break-all;
    flex: 2;
    min-width: 150px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6rem;
    line-height: 1.3;
}
/* ===== КОНЕЦ ИСПРАВЛЕНИЯ 2 ===== */

.link-item .link-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.link-item .link-meta .expired {
    color: #dc2626;
}

.link-item .link-meta .active-badge {
    color: #059669;
}

.link-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.link-actions .btn-action {
    padding: 0.35rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.link-actions .btn-action:hover {
    transform: scale(1.02);
}

.link-actions .btn-action:active {
    transform: scale(0.97);
}

.btn-action-edit {
    background: #eef2ff;
    color: #4338ca;
}

.btn-action-edit:hover {
    background: #dbeafe;
}

.btn-action-delete {
    background: #fef2f2;
    color: #dc2626;
}

.btn-action-delete:hover {
    background: #fee2e2;
}

.btn-action-save {
    background: #667eea;
    color: #ffffff;
}

.btn-action-save:hover {
    background: #5a6fd6;
}

.btn-action-cancel {
    background: #f3f4f6;
    color: #4b5563;
}

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

/* ===== ПАГИНАЦИЯ ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
    width: 100%;
    flex-shrink: 0;
}

.pagination .page-btn {
    padding: 0.3rem 0.7rem;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-width: 2.2rem;
    text-align: center;
    flex-shrink: 0;
}

.pagination .page-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.pagination .page-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-btn.page-nav-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    min-width: 2.2rem;
}

.pagination .page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
    user-select: none;
    min-width: 1.5rem;
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
    text-align: center;
    padding: 2rem 0;
    color: #9ca3af;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* ===== ПОДТВЕРЖДЕНИЕ УДАЛЕНИЯ ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-box {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    max-width: 24rem;
    width: 100%;
    padding: 1.75rem;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    text-align: center;
}

.confirm-overlay.active .confirm-box {
    transform: scale(1);
    opacity: 1;
}

.confirm-box .icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.confirm-box h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.confirm-box p {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 1.25rem;
}

.confirm-box .confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-box .confirm-actions .btn-confirm-yes {
    background: #dc2626;
    color: #ffffff;
    font-weight: 600;
    padding: 0.6rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}

.confirm-box .confirm-actions .btn-confirm-yes:hover {
    background: #b91c1c;
    transform: scale(1.02);
}

.confirm-box .confirm-actions .btn-confirm-no {
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
    padding: 0.6rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}

.confirm-box .confirm-actions .btn-confirm-no:hover {
    background: #e5e7eb;
    transform: scale(1.02);
}

/* ===== ИНДИКАТОР ЗАГРУЗКИ ===== */
.loading-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-center {
    text-align: center;
    padding: 1.5rem 0;
    color: #6b7280;
}

/* ===== МОДАЛЬНОЕ ОКНО РЕЗУЛЬТАТА ===== */
.modal-url-input {
    width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: "SF Mono", "Menlo", "Monaco", monospace;
    color: #1f2937;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 1rem;
    word-break: break-all;
}

.modal-url-input:focus {
    border-color: #667eea;
}

.modal-copy-status {
    font-size: 0.875rem;
    color: #059669;
    margin-bottom: 0.75rem;
    min-height: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn-copy {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}

.modal-actions .btn-copy:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

.modal-actions .btn-copy:active {
    transform: scale(0.97);
}

.modal-actions .btn-close-modal {
    flex: 1;
    background: #e5e7eb;
    color: #4b5563;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}

.modal-actions .btn-close-modal:hover {
    background: #d1d5db;
    transform: scale(1.02);
}

.modal-actions .btn-close-modal:active {
    transform: scale(0.97);
}

/* ===== КАСТОМНОЕ ВСПЛЫВАЮЩЕЕ СООБЩЕНИЕ ===== */
.custom-alert-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
}

.custom-alert-overlay.active {
    display: flex;
}

.custom-alert-box {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    max-width: 24rem;
    width: 100%;
    padding: 1.75rem;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    text-align: center;
}

.custom-alert-overlay.active .custom-alert-box {
    transform: scale(1);
    opacity: 1;
}

.custom-alert-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.custom-alert-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.custom-alert-message {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.custom-alert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
    min-width: 120px;
}

.custom-alert-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

.custom-alert-btn:active {
    transform: scale(0.97);
}

/* ===== FLATPICKR ===== */
.flatpickr-calendar {
    border-radius: 0.75rem !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border: none !important;
    font-family: inherit !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: #667eea !important;
    border-color: #667eea !important;
}

.flatpickr-day.today {
    border-color: #667eea !important;
}

.flatpickr-day.today:hover {
    background: #eef2ff !important;
    border-color: #667eea !important;
    color: #4338ca !important;
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
    background: #f3f4f6 !important;
}

.flatpickr-time .numInputWrapper span.arrowUp:after {
    border-bottom-color: #667eea !important;
}

.flatpickr-time .numInputWrapper span.arrowDown:after {
    border-top-color: #667eea !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: #f3f4f6 !important;
}

.flatpickr-current-month .numInputWrapper:hover {
    background: #f3f4f6 !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: #667eea !important;
}

.expire-datetime-input {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.875rem;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.expire-datetime-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.expire-datetime-input::placeholder {
    color: #9ca3af;
}

.expire-field .input-hint {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* ===== СТИЛИ ДЛЯ ПОЛЕЙ ВРЕМЕНИ В МОДАЛЬНОМ ОКНЕ ===== */
.edit-block .edit-row.extent-field {
    transition: all 0.3s ease;
    overflow: hidden;
}

.edit-block .edit-row.extent-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.edit-block .edit-row.extent-field .expire-datetime-input {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.875rem;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.edit-block .edit-row.extent-field .expire-datetime-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.edit-block .edit-row.extent-field .input-hint {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.edit-block .edit-row.extent-field .input-hint span {
    display: block;
    margin-top: 4px;
}

.edit-block .edit-row.extent-field .input-field {
    font-size: 0.875rem;
    padding: 0.6rem 0.875rem;
}

/* ===== ГРУППЫ В РЕДАКТИРОВАНИИ ===== */
.edit-block .group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.edit-block .edit-row {
    margin-bottom: 1rem;
}

.edit-block .edit-row:last-child {
    margin-bottom: 0;
}

.edit-block .edit-row .chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== СТИЛИ ДЛЯ РЕДАКТОРА WHISPER В МОДАЛЬНОМ ОКНЕ ===== */
.editormd-wrapper {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
}

.editormd-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.editormd-wrapper .editormd {
    border: none !important;
}

.editormd-wrapper .editormd-toolbar {
    border-radius: 0 !important;
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.editormd-wrapper .editormd-toolbar .editormd-toolbar-container {
    background: #f9fafb !important;
}

.editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li a {
    color: #4b5563 !important;
}

.editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li a:hover {
    background: #e5e7eb !important;
    border-radius: 0.25rem !important;
}

.editormd-wrapper .editormd-edit-area {
    border: none !important;
}

.editormd-wrapper .editormd-edit-area .CodeMirror {
    font-size: 0.85rem;
    font-family: "SF Mono", "Menlo", "Monaco", monospace;
}

.editormd-wrapper .editormd-preview {
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.editormd-wrapper .editormd-preview h1,
.editormd-wrapper .editormd-preview h2,
.editormd-wrapper .editormd-preview h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.editormd-wrapper .editormd-preview p {
    margin: 0.5rem 0;
}

.editormd-wrapper .editormd-preview ul,
.editormd-wrapper .editormd-preview ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.editormd-wrapper .editormd-preview code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.editormd-wrapper .editormd-preview pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.editormd-wrapper .editormd-preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.editormd-wrapper .editormd-preview blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: #4b5563;
    background: #f9fafb;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.editormd-wrapper .editormd-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.editormd-wrapper .editormd-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.editormd-wrapper .editormd-preview th,
.editormd-wrapper .editormd-preview td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    text-align: left;
}

.editormd-wrapper .editormd-preview th {
    background: #f3f4f6;
    font-weight: 600;
}

.editormd-wrapper .editormd-preview a {
    color: #667eea;
    text-decoration: underline;
}

.editormd-wrapper .editormd-preview a:hover {
    color: #4338ca;
}

.editormd-wrapper .editormd-preview .editormd-html-preview {
    padding: 0.5rem;
}

.editormd-wrapper.loading {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.editormd-wrapper.active-editor {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.edit-block .extent-whisper-field .editormd-wrapper {
    margin-top: 0.25rem;
}

/* ===== АДАПТИВНОСТЬ ДЛЯ РЕДАКТОРА ===== */

/* Планшеты и маленькие десктопы */
@media (max-width: 1024px) {
    .editormd-wrapper .editormd {
        height: 250px !important;
    }
    .editormd-wrapper .editormd-preview {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li a {
        padding: 0.4rem 0.6rem !important;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .editormd-wrapper .editormd {
        height: 300px !important;
    }
    .editormd-wrapper .editormd-preview {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li a {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    .editormd-wrapper .editormd-edit-area .CodeMirror {
        font-size: 0.8rem !important;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li.hide-on-mobile {
        display: none !important;
    }

    .edit-block .extent-whisper-field .editormd-wrapper .editormd {
        height: 280px !important;
    }
}

/* Очень маленькие мобильные устройства */
@media (max-width: 480px) {
    .editormd-wrapper .editormd {
        height: 350px !important;
    }
    .editormd-wrapper .editormd-preview {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li a {
        padding: 0.3rem 0.4rem !important;
        font-size: 0.7rem !important;
    }
    .editormd-wrapper .editormd-edit-area .CodeMirror {
        font-size: 0.75rem !important;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li {
        display: none;
    }
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li:first-child,
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li:nth-child(2),
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li:nth-child(3),
    .editormd-wrapper .editormd-toolbar .editormd-toolbar-container ul li:last-child {
        display: inline-block;
    }

    .edit-block .extent-whisper-field .editormd-wrapper .editormd {
        height: 300px !important;
    }
}

/* ===== ЕДИНОЕ МОДАЛЬНОЕ ОКНО РЕДАКТИРОВАНИЯ ===== */
#editModal .modal-box {
    max-width: 48rem;
    width: 100%;
    max-height: 90vh;
}

#editModal .modal-body {
    padding: 1.25rem 1.75rem;
    max-height: 70vh;
    overflow-y: auto;
}

#editModal .edit-row {
    margin-bottom: 1rem;
}

#editModal .edit-row:last-child {
    margin-bottom: 0;
}

#editModal .edit-row .group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

#editModal .extent-field {
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0;
}

#editModal .extent-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

#editModal .extent-field .input-field {
    font-size: 0.875rem;
    padding: 0.6rem 0.875rem;
}

#editModal .extent-field .input-hint {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

#editModal .chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#editModal .feature-chip {
    display: inline-flex;
    transition: transform 0.15s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#editModal .feature-chip:hover {
    transform: scale(1.04);
}

#editModal .feature-chip:active {
    transform: scale(0.95);
}

#editModal .feature-chip input {
    display: none;
}

#editModal .feature-chip label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
}

#editModal .feature-chip input:checked + label {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
    box-shadow: 0 0 0 2px #667eea;
}

#editModal .btn-secondary {
    flex: 1;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-weight: 500;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
    color: #4b5563;
}

#editModal .btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: scale(1.02);
}

#editModal .btn-secondary:active {
    transform: scale(0.97);
}

/* ===== АДАПТИВНОСТЬ ДЛЯ ЕДИНОГО МОДАЛЬНОГО ОКНА ===== */

@media (max-width: 768px) {
    #editModal .modal-box {
        max-width: 95%;
        max-height: 95vh;
    }
    #editModal .modal-header {
        padding: 1rem 1.25rem;
    }
    #editModal .modal-body {
        padding: 1rem 1.25rem;
        max-height: 65vh;
    }
    #editModal .feature-chip label {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }
    #editModal .chips-wrapper {
        gap: 0.4rem;
    }
}

@media (max-width: 480px) {
    #editModal .modal-box {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 1rem;
        margin: 0.5rem;
    }
    #editModal .modal-header {
        padding: 0.75rem 1rem;
    }
    #editModal .modal-header h3 {
        font-size: 1.1rem;
    }
    #editModal .modal-body {
        padding: 0.75rem 1rem;
        max-height: 60vh;
    }
    #editModal .feature-chip label {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
        gap: 0.25rem;
    }
    #editModal .chips-wrapper {
        gap: 0.3rem;
    }
    #editModal .extent-field .input-field {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    #editModal .btn-secondary {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    #editModal .edit-row {
        margin-bottom: 0.75rem;
    }
}

/* ===== СТИЛИ ДЛЯ СПИСКА ССЫЛОК В УПРАВЛЕНИИ ===== */

#linksList .link-item {
    border: 2px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, background 0.2s ease;
    margin-bottom: 0.5rem;
}

#linksList .link-item:hover {
    border-color: #e5e7eb;
    background: #fafafa;
}

#linksList .link-item .link-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

#linksList .link-item .link-short {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
    word-break: break-all;
    flex: 1;
    min-width: 120px;
}

#linksList .link-item .link-short:hover {
    text-decoration: underline;
}

#linksList .link-item .link-target {
    font-size: 0.8rem;
    color: #6b7280;
    word-break: break-all;
    flex: 2;
    min-width: 150px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6rem;
    line-height: 1.3;
}

#linksList .link-item .link-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#linksList .link-item .link-meta .expired {
    color: #dc2626;
}

#linksList .link-item .link-meta .active-badge {
    color: #059669;
}

#linksList .link-actions .btn-action {
    padding: 0.35rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

#linksList .link-actions .btn-action:hover {
    transform: scale(1.02);
}

#linksList .link-actions .btn-action:active {
    transform: scale(0.97);
}

#linksList .btn-action-edit {
    background: #eef2ff;
    color: #4338ca;
}

#linksList .btn-action-edit:hover {
    background: #dbeafe;
}

#linksList .btn-action-delete {
    background: #fef2f2;
    color: #dc2626;
}

#linksList .btn-action-delete:hover {
    background: #fee2e2;
}

/* ===== ПАГИНАЦИЯ ===== */

.pagination .page-btn {
    padding: 0.3rem 0.7rem;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-width: 2.2rem;
    text-align: center;
    flex-shrink: 0;
}

.pagination .page-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.pagination .page-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-btn.page-nav-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    min-width: 2.2rem;
}

.pagination .page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
    user-select: none;
    min-width: 1.5rem;
}

/* Адаптивность для пагинации */
@media (max-width: 480px) {
    .pagination {
        gap: 0.2rem;
        padding: 0.25rem 0.1rem;
    }
    .pagination .page-btn {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
        min-width: 1.6rem;
        border-radius: 0.375rem;
        border-width: 1.5px;
    }
    .pagination .page-btn.page-nav-btn {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
        min-width: 1.6rem;
    }
    .pagination .page-ellipsis {
        font-size: 0.65rem;
        padding: 0.15rem 0.2rem;
        min-width: 1.2rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .pagination {
        gap: 0.3rem;
        padding: 0.25rem 0.15rem;
    }
    .pagination .page-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.45rem;
        min-width: 1.8rem;
        border-radius: 0.4rem;
    }
    .pagination .page-btn.page-nav-btn {
        font-size: 0.65rem;
        padding: 0.2rem 0.35rem;
        min-width: 1.8rem;
    }
    .pagination .page-ellipsis {
        font-size: 0.7rem;
        padding: 0.2rem 0.25rem;
        min-width: 1.3rem;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 380px) {
    .pagination {
        gap: 0.15rem;
    }
    .pagination .page-btn {
        font-size: 0.55rem;
        padding: 0.1rem 0.25rem;
        min-width: 1.4rem;
        border-radius: 0.3rem;
    }
    .pagination .page-btn.page-nav-btn {
        font-size: 0.5rem;
        padding: 0.1rem 0.2rem;
        min-width: 1.4rem;
    }
    .pagination .page-ellipsis {
        font-size: 0.55rem;
        padding: 0.1rem 0.15rem;
        min-width: 1rem;
    }
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
    text-align: center;
    padding: 2rem 0;
    color: #9ca3af;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* ===== ОБЩАЯ АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
    .header-title h1 {
        font-size: 1.75rem;
    }
    .input-row {
        flex-direction: column;
        gap: 0.625rem;
    }
    .btn-primary {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }
    .btn-primary svg {
        width: 1.125rem;
        height: 1.125rem;
    }
    .feature-chip label {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }
    .chips-wrapper {
        gap: 0.4rem;
    }
    .desc-grid {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .desc-item {
        padding: 0.3rem 0.5rem;
    }
    .desc-item .desc-text {
        font-size: 0.75rem;
    }
    .modal-box {
        max-width: 95%;
        max-height: 95vh;
    }
    .modal-header {
        padding: 1rem 1.25rem;
    }
    .modal-body {
        padding: 1rem 1.25rem;
    }
    .link-item .link-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .link-item .link-meta {
        white-space: normal;
        flex-wrap: wrap;
    }
    .search-row {
        flex-direction: column;
    }
    #manageModal .modal-body {
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 1rem;
    }
    .card-body {
        padding: 1.125rem;
    }
    .card {
        border-radius: 1rem;
    }
    .header-title {
        margin-bottom: 1rem;
    }
    .header-title h1 {
        font-size: 1.5rem;
    }
    .header-title p {
        font-size: 0.8rem;
    }
    .input-field {
        padding: 0.6rem 0.875rem;
        font-size: 0.9rem;
        border-radius: 0.625rem;
    }
    .btn-primary {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
        border-radius: 0.625rem;
    }
    .settings-group {
        margin-top: 1rem;
    }
    .settings-group + .settings-group {
        margin-top: 0.75rem;
    }
    .group-title {
        font-size: 0.6rem;
        margin-bottom: 0.35rem;
    }
    .feature-chip label {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
        gap: 0.25rem;
    }
    .chips-wrapper {
        gap: 0.3rem;
    }
    .extent-field.show {
        margin-top: 0.5rem;
    }
    .extent-field label {
        font-size: 0.7rem;
    }
    .extent-field .input-field,
    .expire-datetime-input {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    .extent-field .input-hint {
        font-size: 0.6rem;
    }
    .accordion-toggle {
        font-size: 0.7rem;
        padding: 0.4rem 0;
    }
    .accordion-content.open {
        padding: 0.5rem 0 0.15rem 0;
    }
    .desc-grid {
        gap: 0.2rem;
    }
    .desc-item {
        padding: 0.25rem 0.4rem;
        gap: 0.35rem;
    }
    .desc-item .icon {
        font-size: 0.8rem;
        width: 1.1rem;
    }
    .desc-item .desc-text {
        font-size: 0.7rem;
    }
    .stats-text {
        font-size: 0.6rem;
        margin-top: 1rem;
        padding-top: 0.5rem;
        min-height: 2rem;
    }
    .modal-box {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 1rem;
        margin: 0.5rem;
    }
    .modal-header {
        padding: 0.75rem 1rem;
    }
    .modal-header h3 {
        font-size: 1.1rem;
    }
    .modal-body {
        padding: 0.75rem 1rem;
    }
    .link-item {
        padding: 0.5rem 0.75rem;
    }
    .link-item .link-short {
        font-size: 0.8rem;
    }
    .link-item .link-target {
        font-size: 0.7rem;
        max-height: 2.2rem;
        -webkit-line-clamp: 2;
        min-width: 100px;
    }
    .link-item .link-meta {
        font-size: 0.6rem;
        gap: 0.3rem;
    }
    .link-item .link-meta span {
        margin-right: 0.2rem;
    }
    .modal-actions {
        flex-direction: column;
    }
    .custom-alert-box {
        padding: 1.25rem;
        max-width: 95%;
    }
    .custom-alert-icon {
        font-size: 2.5rem;
    }
    .custom-alert-title {
        font-size: 1rem;
    }
    .custom-alert-message {
        font-size: 0.85rem;
    }
    .custom-alert-btn {
        font-size: 0.85rem;
        padding: 0.55rem 1.5rem;
        min-width: 100px;
    }
    .confirm-box {
        padding: 1.25rem;
        max-width: 95%;
    }
    #manageModal .modal-body {
        padding: 0.75rem 1rem;
    }
}

@media (min-width: 1600px) {
    .main-container {
        max-width: 56rem;
    }
    .card-body {
        padding: 2.5rem;
    }
    .header-title h1 {
        font-size: 2.75rem;
    }
    .header-title p {
        font-size: 1rem;
    }
    .input-field {
        font-size: 1.125rem;
        padding: 0.875rem 1.25rem;
    }
    .btn-primary {
        font-size: 1.125rem;
        padding: 0.875rem 2rem;
    }
    .feature-chip label {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    #editor {
        height: 250px;
    }
    .desc-item .desc-text {
        font-size: 0.85rem;
    }
}

@supports (padding: max(0px)) {
    .modal-overlay,
    .custom-alert-overlay,
    .confirm-overlay {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
