body {
    font-family: sans-serif;
    padding: 20px;
    background-color: #f0f2f5;
    margin: 0;
}

.action-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.upload-section, .export-section, .report-info-section {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-info-section {
    flex-grow: 1; /* 横幅をいい感じに広げる */
}

.upload-section label, .export-section label, .report-info-section label {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.meta-inputs {
    display: flex;
    gap: 10px;
}

input[type="text"], input[type="date"], textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.report-info-section textarea {
    resize: vertical;
    min-height: 50px;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-pdf { background-color: #ef4444; color: white; }
.btn-pdf:hover { background-color: #dc2626; }
.btn-img { background-color: #3b82f6; color: white; }
.btn-img:hover { background-color: #2563eb; }

.preview-area { display: flex; flex-wrap: wrap; gap: 20px; }
.image-card {
    background: #fff; padding: 15px; border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); width: 300px;
    display: flex; flex-direction: column; gap: 10px;
}
.drag-handle { background-color: #e2e8f0; color: #475569; text-align: center; padding: 8px; border-radius: 4px; font-size: 14px; cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; background-color: #f1f5f9; }
.img-container { width: 100%; height: 250px; background-color: #eee; overflow: hidden; }
.img-container img { display: block; max-width: 100%; }
.controls { display: flex; justify-content: space-between; }
textarea { resize: vertical; min-height: 60px; }

/* ==========================================================================
   ★ 出力・印刷用のA4レイアウト（ヘッダー・備考欄対応版）
   ========================================================================== */
/* ==========================================================================
   出力・印刷用レイアウト
   ========================================================================== */

.print-container {
    position: absolute;
    left: -9999px;
    top: 0;
}

.a4-page {
    width: 1190px;
    height: 1684px;
    background: #fff;
    padding: 50px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    gap: 20px;

    overflow: hidden;
    page-break-after: always;

    position: relative;

}

/* =========================
   ヘッダー
   ========================= */

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    border-bottom: 3px solid #1e293b;
    padding-bottom: 10px;
}

.print-header h1 {
    margin: 0;
    font-size: 36px;
    color: #1e293b;
}

.print-meta {
    text-align: right;
    font-size: 20px;

    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* =========================
   写真グリッド
   ========================= */

.print-grid {
    flex: 1;

    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);

    gap: 20px;

    min-height: 0;
}

.print-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;

    padding: 12px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

/* =========================
   画像
   ========================= */

.print-img-box {
    width: 100%;
    height: 300px;

    display: flex;
    justify-content: center;
    align-items: center;

    overflow:hidden;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.print-img-box img {
    max-width:100%;
    max-height:100%;
    width:auto;
    height:auto;
    object-fit:contain;
}

/* =========================
   タイトル
   ========================= */

.print-title {
    margin: 10px 0 5px 0;

    font-size: 18px;
    font-weight: bold;

    height: 28px;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    border-bottom: 2px solid #3b82f6;
}

/* =========================
   コメント
   ========================= */

.print-comment {
    margin: 0;

    font-size: 14px;
    line-height: 1.4;

    overflow: hidden;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* =========================
   備考
   ========================= */

.print-remarks {
    border: 2px solid #cbd5e1;
    border-radius: 6px;

    padding: 15px;

    background-color: #f8fafc;

    margin-top: 10px;
}

.print-remarks h3 {
    margin: 0 0 10px 0;

    font-size: 20px;
    color: #1e293b;
}

.print-remarks p {
    margin: 0;

    font-size: 16px;
    line-height: 1.6;

    white-space: pre-wrap;
}

/* =========================
   備考専用ページ
   ========================= */

.print-remarks-full {
    flex: 1;

    border: 2px solid #cbd5e1;
    border-radius: 6px;

    padding: 20px;

    background: #f8fafc;

    overflow: auto;
}

.print-remarks-full h2 {
    margin-top: 0;
}

.page-number {
    position: absolute;
    bottom: 15px;
    right: 30px;

    font-size: 14px;
    color: #64748b;
}

.notice-box {
    background: #fff7ed;
    border: 1px solid #fdba74;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.image-counter {
    margin-top: 10px;
    margin-bottom: 15px;

    padding: 10px;

    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 6px;

    font-size: 14px;
    line-height: 1.6;
}