.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.search-area {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    align-items: center;
}

.search-input {
    width: min(640px, 100%);
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
}

.search-button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
}

.search-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.view-mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    border-bottom: 1px solid #ddd;
}

.view-mode-tab {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-bottom: 0;
    background-color: #f5f5f5;
    cursor: pointer;
}

.view-mode-tab.active {
    background-color: #fff;
    font-weight: 600;
}

.view-mode-tab:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.work-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(520px, 1.2fr);
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

.results-column,
.records-column,
.viewer-column {
    min-width: 0;
}

.results-column {
    overflow: hidden;
}

.viewer-column {
    border-left: 1px solid #ddd;
    padding-left: 1.5rem;
    height: calc(100vh - 220px);
    max-height: calc(100vh - 220px);
    position: sticky;
    top: 1rem;
    min-height: 0;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    margin-top: 1rem;
    max-width: 100%;
}

.work-layout .table-wrapper {
    max-height: calc(100vh - 260px);
    overflow: auto;
    border: 1px solid #ddd;
}

.iiif-viewer-pane {
    height: 100%;
    min-height: 240px;
    overflow: hidden;
    border: 1px solid #ddd;
    background-color: #fff;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.iiif-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.iiif-viewer-header h2 {
    margin: 0;
}

.iiif-viewer-list {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.iiif-viewer {
    flex: 1 1 0;
    min-height: 180px;
    border: 1px solid #ddd;
    background-color: #f5f5f5;
}

.resizable-pane {
    resize: vertical;
    overflow: auto;
}

.muted-message {
    color: #666;
    background-color: #fafafa;
    border: 1px dashed #ccc;
    padding: 0.75rem;
    margin-top: 1rem;
}

.problem-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.work-layout .problem-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.problem-table th,
.problem-table td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    vertical-align: top;
}

.problem-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    white-space: nowrap;
}

.content-cell {
    min-width: 240px;
    max-width: 520px;
    white-space: pre-wrap;
    word-break: break-word;
}

.problem-search-table {
    table-layout: fixed;
    width: 100%;
    min-width: 720px;
}

.problem-search-table .problem-search-operation-col {
    width: 88px;
}

.problem-search-table .problem-search-meta-col {
    width: clamp(200px, 24%, 300px);
}

.problem-search-table .problem-search-content-col {
    width: auto;
}

.problem-search-table .operation-cell {
    white-space: nowrap;
}

.problem-search-table .problem-meta-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.45;
    background-color: #fafafa;
}

.problem-search-table .problem-content-cell {
    min-width: 0;
    max-width: none;
    width: auto;
    line-height: 1.65;
}

.book-list-table {
    table-layout: fixed;
    width: 100% !important;
    min-width: 720px;
}

.book-list-table .operation-cell {
    width: auto;
    white-space: nowrap;
}

.book-list-table .book-meta-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    line-height: 1.35;
    background-color: #fafafa;
}

.book-list-table .book-content-cell {
    max-width: none;
    width: auto;
    line-height: 1.35;
    font-size: 0.925rem;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.compact-content-line {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 0.25rem;
    margin-bottom: 0.15rem;
}

.compact-content-line:last-child {
    margin-bottom: 0;
}

.compact-content-label {
    flex: 0 0 auto;
    color: #555;
    font-weight: 600;
    white-space: nowrap;
}

.compact-content-value {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.image-number-cell {
    min-width: 96px;
    white-space: nowrap;
    text-align: center;
}

.image-button-group {
    margin-top: 0.25rem;
}

.highlighted-content {
    line-height: 1.9;
}

.diff-token {
    border-radius: 0.2rem;
    padding: 0.05rem 0.12rem;
    margin: 0 0.02rem;
}

.diff-kind {
    background-color: #fff3bf;
    border-bottom: 2px solid #ffd43b;
}

.diff-furigana {
    background-color: #d0ebff;
    border-bottom: 2px solid #74c0fc;
}

.diff-gap-minor {
    background-color: #e9ecef;
    border-bottom: 2px solid #adb5bd;
}

.diff-soft {
    background-color: #e5dbff;
    border-bottom: 2px solid #b197fc;
}

.diff-replace {
    background-color: #ffe066;
    border-bottom: 2px solid #f08c00;
}

.diff-insert {
    background-color: #ffc9c9;
    border-bottom: 2px solid #fa5252;
}

.error-message {
    color: #b00020;
    background-color: #ffecec;
    border: 1px solid #ffb3b3;
    padding: 0.75rem;
    margin: 1rem 0;
}

.small-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
}

.small-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.selected-row {
    background-color: #fff7d6;
}

.selected-row > td {
    background-color: #fff7d6;
}


.viewer1-row {
    box-shadow: inset 4px 0 0 #0d6efd;
}

.viewer1-row > td:first-child {
    box-shadow: inset 4px 0 0 #0d6efd;
}

.viewer1 {
    box-shadow: -4px 0 0 #0d6efd;
}

.viewer1-cell {
    box-shadow: inset 4px 0 0 #0d6efd;
}

.viewer2-row {
    box-shadow: inset 4px 0 0 #fd7e14;
}

.viewer2-row > td:first-child {
    box-shadow: inset 4px 0 0 #fd7e14;
}

.viewer2 {
    box-shadow: -4px 0 0 #fd7e14;
}

.viewer2-cell {
    box-shadow: inset 4px 0 0 #fd7e14;
}

.selected-record {
    border: 1px solid #ddd;
    background-color: #fafafa;
    padding: 0.75rem;
    margin: 0.75rem 0 1rem;
    line-height: 1.6;
}

.problem-title-summary-table {
    table-layout: fixed;
    width: 100%;
    min-width: 900px;
}

.problem-title-summary-table .problem-title-meta-col {
    width: 22%;
}

.problem-title-summary-table .problem-title-index-col {
    width: 30%;
}

.problem-title-summary-table .problem-title-title-col {
    width: 30%;
}

.problem-title-summary-table .problem-title-note-col {
    width: 18%;
}

.problem-title-summary-table .problem-title-meta-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    line-height: 1.35;
    background-color: #fafafa;
}

.problem-title-summary-table .problem-title-content-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.925rem;
    line-height: 1.4;
}

.problem-title-summary-table .problem-title-note-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.925rem;
    line-height: 1.4;
}

.inline-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.work-layout .problem-title-table {
    min-width: 820px;
}

.work-layout .problem-title-table .col-id {
    width: 72px;
}

.work-layout .problem-title-table .col-unified-name {
    width: clamp(96px, 10vw, 160px);
}

.work-layout .problem-title-table .col-book-id {
    width: 56px;
}

.work-layout .problem-title-table .col-book {
    width: clamp(80px, 8vw, 120px);
}

.work-layout .problem-title-table .col-jo-number {
    width: 56px;
}

.work-layout .problem-title-table .col-kan-name {
    width: clamp(64px, 7vw, 100px);
}

.work-layout .problem-title-table .col-index-title,
.work-layout .problem-title-table .col-problem-title {
    width: clamp(140px, 15vw, 240px);
}

.work-layout .problem-title-table .col-image-number {
    width: 72px;
}

.work-layout .problem-title-table .col-note {
    width: clamp(120px, 12vw, 220px);
}

@media (max-width: 1200px) {
    .work-layout {
        grid-template-columns: 1fr;
    }

    .viewer-column {
        border-left: 0;
        border-top: 1px solid #ddd;
        padding-left: 0;
        padding-top: 1rem;
        height: 720px;
        max-height: none;
        position: static;
    }
}

@media (max-width: 720px) {
    .search-area {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .search-button {
        width: 100%;
    }

    .view-mode-tabs {
        flex-wrap: wrap;
    }

    .view-mode-tab {
        flex: 1 1 auto;
    }

    .viewer-column {
        height: 640px;
    }

    .iiif-viewer {
        min-height: 220px;
    }

    .selected-record {
        border: 1px solid #ddd;
        background-color: #fafafa;
        padding: 0.75rem;
        margin: 0.75rem 0 1rem;
        line-height: 1.6;
    }

    .muted-inline {
        color: #666;
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }
}