body {
    background: #f7f8fa;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.toolbar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.table-wrap {
    overflow: auto;
    max-height: 560px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* 画像紐付け画面は、ファイル名より画像プレビューを優先する */
#imageTable {
    table-layout: fixed;
}

#imageTable th:nth-child(1),
#imageTable td:nth-child(1) {
    width: 20%;
}

#imageTable th:nth-child(2),
#imageTable td:nth-child(2) {
    width: 25%;
    overflow-wrap: anywhere;
}

#imageTable th:nth-child(3),
#imageTable td:nth-child(3) {
    width: 18%;
}

#imageTable th:nth-child(4),
#imageTable td:nth-child(4) {
    width: 12%;
}

#imageTable th:nth-child(5),
#imageTable td:nth-child(5) {
    width: 25%;
}

th, td {
    border-bottom: 1px solid #e9ecef;
    padding: 8px;
    vertical-align: middle;
}

th {
    background: #f1f3f5;
    position: sticky;
    top: 0;
    z-index: 1;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 260px;
    font-family: inherit;
}

pre.output {
    background: #212529;
    color: #f8f9fa;
    padding: 14px;
    overflow: auto;
    min-height: 120px;
}

.status-ok { color: #198754; font-weight: 700; }
.status-warning { color: #997404; font-weight: 700; }
.status-error { color: #dc3545; font-weight: 700; }

.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .65);
}

.image-preview-modal[hidden] {
    display: none;
}

.image-preview-modal img {
    display: block;
    max-width: min(90vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    cursor: zoom-out;
}

.image-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.image-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 6px;
    background: #fff;
    cursor: move;
}

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; flex-direction: column; }
}
