.task-word-link { color: #536c4d; text-decoration: underline; text-underline-offset: 3px; }
.completed .task-word-link { color: inherit; }
.task-link-preview-trigger { display: none; }
.task-link-preview {
    position: fixed; z-index: 2200; box-sizing: border-box; width: min(350px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid #dddcd4; border-radius: 16px;
    background: white; color: #1a1a18; box-shadow: 0 12px 40px #0003; font: 14px/1.5 Arial, sans-serif;
}
.task-link-preview[hidden], .task-link-preview [hidden] { display: none; }
.task-link-preview-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; }
.task-link-preview-site { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #75736c; font-size: 12px; }
.task-link-preview-close {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    padding: 0; border: 0; border-radius: 7px; background: transparent; color: #75736c; font-size: 23px; cursor: pointer;
}
.task-link-preview-close:hover { background: #f1f3ee; }
.task-link-preview-media { position: relative; background: #f1f3ee; }
.task-link-preview-image { display: block; width: 100%; height: 165px; object-fit: cover; background: #f1f3ee; }
.task-link-preview-direct-image .task-link-preview-image { height: 210px; object-fit: contain; }
.task-link-preview-media[aria-busy="true"] .task-link-preview-image { opacity: 0; }
.task-link-preview-image-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 6px 10px; border-radius: 8px; background: #f1f3ee; color: #75736c; white-space: nowrap; pointer-events: none; }
.task-link-preview-gallery { position: absolute; inset: 0; pointer-events: none; }
.task-link-preview-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0 0 3px; border: 1px solid #ffffff80; border-radius: 50%;
    background: #1a1a18bb; color: white; cursor: pointer; font: 30px/1 Arial, sans-serif; pointer-events: auto;
}
.task-link-preview-previous { left: 10px; }
.task-link-preview-next { right: 10px; }
.task-link-preview-arrow:hover:not(:disabled) { background: #1a1a18ee; }
.task-link-preview-arrow:disabled { opacity: .35; cursor: default; }
.task-link-preview-image-navigation {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; align-items: center; gap: 5px;
    padding: 1px 8px 1px 3px; border-radius: 20px; background: #1a1a18c9; color: white; pointer-events: auto;
}
.task-link-preview-image-dots { display: flex; }
.task-link-preview-image-choice {
    display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 30px;
    padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.task-link-preview-image-choice::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ffffff70; }
.task-link-preview-image-choice[aria-pressed="true"]::before { background: white; }
.task-link-preview-image-count { font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-link-preview-body { padding: 16px; }
.task-link-preview h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.task-link-preview-description { margin: 0 0 12px; color: #75736c; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.task-link-preview-open { display: inline-flex; align-items: center; gap: 8px; color: #536c4d; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.task-link-preview button:focus-visible, .task-link-preview a:focus-visible { outline: 2px solid #536c4d; outline-offset: 2px; }
@media (hover: none) {
    .task-link-preview-trigger {
        display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
        width: 28px; height: 30px; margin: 0 2px; padding: 4px; border: 0; border-radius: 6px;
        background: transparent; color: #75736c; cursor: pointer;
    }
    .task-link-preview-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
    .task-link-preview-trigger:focus-visible { outline: 2px solid #536c4d; outline-offset: 1px; }
    .task-link-preview-close { width: 38px; height: 38px; }
    .task-link-preview-arrow { width: 42px; height: 42px; }
    .task-link-preview-image-choice { width: 30px; height: 38px; }
}
.task-link-button {
    flex: 0 0 36px; width: 36px; height: 40px; padding: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: #75736c; cursor: pointer;
}
.task-link-button:hover { color: #536c4d; background: #f1f3ee; }
.task-link-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.task-link-button:focus-visible { outline: 2px solid #536c4d; outline-offset: 2px; }
.task-link-dialog {
    box-sizing: border-box; width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
    margin: auto; padding: 28px; border: 1px solid #e3e1db; border-radius: 20px;
    background: #fff; color: #1a1a18; box-shadow: 0 20px 80px #0003; overflow: auto;
    font-family: Arial, sans-serif;
}
.task-link-dialog::backdrop { background: #24262080; }
.task-link-form { display: grid; gap: 10px; }
.task-link-form h2 { margin: 0; font-size: 24px; line-height: 1.25; }
.task-link-hint { margin: 0 0 10px; color: #75736c; line-height: 1.5; font-size: 14px; }
.task-link-form label { font-size: 14px; font-weight: 600; margin-top: 4px; }
.task-link-form input:not([type="radio"]), .task-link-form textarea {
    box-sizing: border-box; min-width: 0; width: 100%; padding: 12px;
    border: 1px solid #d7d3cc; border-radius: 10px; background: white; color: #1a1a18;
    font: inherit; font-size: 16px; line-height: 1.4;
}
.task-link-form textarea { background: #f8f7f3; resize: vertical; }
.task-link-form input:focus-visible, .task-link-form textarea:focus-visible {
    outline: 2px solid #536c4d; outline-offset: 2px;
}
.task-link-form [hidden] { display: none; }
.task-link-occurrences { min-width: 0; padding: 0; margin: 4px 0; border: 0; }
.task-link-occurrences legend { padding: 0; font-size: 14px; font-weight: 600; }
.task-link-occurrence-hint { margin: 6px 0 10px; color: #75736c; font-size: 13px; line-height: 1.4; }
.task-link-occurrence-options { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; padding: 3px; }
.task-link-form .task-link-occurrence-option {
    display: flex; align-items: flex-start; gap: 12px; min-height: 44px; box-sizing: border-box;
    margin: 0; padding: 12px; border: 1px solid #d7d3cc; border-radius: 10px;
    background: white; cursor: pointer; font-size: 16px; font-weight: 400; line-height: 1.6;
}
.task-link-occurrence-option:hover { background: #f8f9f6; }
.task-link-occurrence-option.selected { border-color: #536c4d; background: #f5f7f2; }
.task-link-occurrence-option:focus-within { outline: 2px solid #536c4d; outline-offset: 1px; }
.task-link-occurrence-option input[type="radio"] {
    flex: 0 0 18px; width: 18px; height: 18px; margin: 4px 0 0; accent-color: #536c4d; cursor: pointer;
}
.task-link-occurrence-sentence { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-link-occurrence-match {
    background: #e7eedf; color: #536c4d; font-weight: 600; border-radius: 3px;
    text-decoration: underline; text-underline-offset: 3px;
}
.task-link-existing:empty, .task-link-error:empty { display: none; }
.task-link-existing h3 { font-size: 14px; margin: 12px 0 8px; }
.task-link-existing-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.task-link-existing-row button, .task-link-actions button {
    min-height: 44px; padding: 10px 14px; border: 1px solid #dfddd6; border-radius: 10px;
    font: inherit; font-size: 14px; cursor: pointer; background: white; color: #1a1a18;
}
.task-link-existing-row .task-link-edit { flex: 1; min-width: 0; text-align: left; overflow-wrap: anywhere; color: #536c4d; }
.task-link-error { margin: 4px 0; color: #a02f27; font-size: 14px; line-height: 1.5; }
.task-link-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.task-link-actions .task-link-save { background: #1a1a18; color: white; border-color: #1a1a18; }
@media (max-width: 480px) {
    .task-link-dialog { padding: 20px; }
    .task-link-button { flex-basis: 30px; width: 30px; padding: 5px; min-height: 44px; }
}
