@charset "UTF-8";
:root{--line:#9ba3ad;--soft:#f5f7f9;--panel:#fff;--accent:#5ca05c;--muted:#cfd6dd}
*{box-sizing:border-box}
body{font-family:"Yu Gothic UI",Meiryo,sans-serif;background-color:#f6f9f6;color:#222;margin:0;padding:2vw;padding-top:60px;display:flex;flex-direction:column;align-items:center}
header{background:#CF0027;color:#fff;padding:10px 20px;font-weight:700;border-bottom:1px solid #b00020;position:fixed;top:0;left:0;width:100%;z-index:1000;display:grid;grid-template-columns:1fr auto 1fr;align-items:center}
.header-title{grid-column:2;text-align:center;white-space:nowrap}
.login{grid-column:3;display:flex;gap:10px;align-items:center;justify-content:flex-end;cursor:pointer}
@media screen and (max-width:600px){
    header{padding:5px 8px;grid-template-columns:auto 1fr;display:flex;justify-content:space-between}
    .header-title{font-size:14px;text-align:left;margin-right:auto}
    .login{gap:4px}
    .login span{font-size:11px}
    .login button{padding:3px 8px;font-size:11px}
}
.topbar{display:flex;gap:10px;justify-content:center;margin:10px 0;padding:0 10px;flex-wrap:wrap;position:sticky;top:55px;z-index:1000}
button{border:1px solid #aab4c0;border-radius:8px;background:#f3f5f7;padding:6px 16px;cursor:pointer;font-size:14px}
button:hover{background-color:#e2e6ea}
button.primary{background:#e6f5ea;border-color:#7fbf90}
button.danger{background:#fdecec;border-color:#ee8b8b}
.btn-mini{padding:5px 10px;border-radius:6px;border:1px solid #b7c0ca;background:#edf1f5;font-size:12px}
.btn-mini[disabled]{opacity:.55;cursor:not-allowed}
.container{width:100%;max-width:100%;margin:0 auto;padding:0 10px}
.card{border:1px solid var(--line);border-radius:12px;background:var(--panel);overflow:hidden;box-shadow:0 2px 0 rgba(0,0,0,.03) inset;max-width:100%;margin:0 auto 18px}
.tabs{display:flex;justify-content:center;gap:4px;margin:10px 20px 20px;background:#e2e6ea;padding:4px;border-radius:999px;width:fit-content;margin-left:auto;margin-right:auto}
.tab{padding:8px 24px;border:none;background:transparent;cursor:pointer;border-radius:999px;color:#55606e;font-weight:600;transition:all .2s ease}
.tab.active{background:#fff;color:#2b70b6;font-weight:700;box-shadow:0 2px 4px rgba(0,0,0,.1)}
.tab-content{display:none;background:transparent;margin:0 0 24px;border:none;padding:0}
.tab-content.active{display:block}
.row{display:grid;grid-template-columns:170px 1fr;gap:10px;align-items:center;border-top:1px solid var(--muted);padding:8px 12px}
.row:first-child{border-top:none}
.row.action{display:flex;justify-content:center;padding:20px}
.row .label{background:var(--soft);border:none;border-radius:8px;padding:8px 10px;font-weight:600;display:flex;align-items:center;gap:6px}
.req{color:#d23c3c;font-weight:700}
.row .ctrl{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.row-grid{display:grid;grid-template-columns:1fr 1fr}
@media screen and (max-width:900px){.row-grid{grid-template-columns:1fr}}
.row .ctrl input[type=text],.row .ctrl input[type=number],.row .ctrl input[type=date],.row .ctrl input[type=time],.row .ctrl select,.row .ctrl textarea{width:100%;max-width:100%;padding:6px 8px;border:1px solid #bfc7d1;border-radius:6px;background:#fff}
.row .ctrl textarea{min-height:80px;resize:vertical}
@media screen and (min-width:900px){
    .card{display:grid;grid-template-columns:1fr 1fr;gap:0;border-top:1px solid var(--muted)}
    .row{border-top:1px solid var(--muted);border-right:1px solid var(--muted);margin-top:-1px}
    .row:nth-child(2n){border-right:none}
    .row.full{grid-column:1/-1;border-right:none}
}
@media screen and (max-width:600px){
    .row{grid-template-columns:1fr;gap:4px}
    .row .label{width:100%}
    .row .ctrl select{max-width:100%!important}
    .tab-content{margin:0 10px 24px;overflow-x:hidden}
    .tabs{margin:10px 10px 20px;width:auto;gap:2px}
    .tab{padding:6px 12px;font-size:11px;white-space:nowrap}
}
.file-row{display:flex;align-items:center;gap:8px;width:100%}
.file-input{position:relative;display:inline-block}
.file-input input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}
.file-btn{background:#e9edf2;border:1px solid #b7c0ca;border-radius:6px;padding:6px 10px;display:inline-block}
.filename{color:#2f6fb0;text-decoration:underline;cursor:pointer}
.thumb-strip{display:flex;flex-wrap:wrap;gap:10px;align-content:flex-start;justify-content:flex-start;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
.thumb-item{position:relative;display:inline-block;border:1px solid #cfd6dd;background:#fff;border-radius:8px;padding:6px}
.thumb-item img{max-height:200px;width:auto;max-width:520px;display:block;object-fit:contain;border-radius:6px}
.thumb-x{position:absolute;top:4px;right:4px;width:22px;height:22px;border-radius:999px;border:1px solid #b7c0ca;background:#fff;cursor:pointer;line-height:20px;text-align:center;font-weight:700}
@media screen and (max-width:600px){
    .file-row{flex-wrap:wrap;align-items:flex-start}
    .file-input,.file-btn,.filename{width:100%;display:block;margin-bottom:5px}
    .file-btn{text-align:center}
    body.page1{align-items:stretch}
    #frm,.page-group-print,.print-group,.group-info-table,.kTable,.graphs-row{width:100%}
}
table{border-collapse:collapse;width:100%;table-layout:fixed;margin-bottom:1mm;font-size:12pt}
th,td{border:1px solid #999;padding:4px 6px;vertical-align:middle}
th{background:#f2f2f2;text-align:center;font-weight:700}
td{background:#fff}
.kTable{width:100%;border-collapse:collapse;table-layout:fixed}
.kTable th,.kTable td{border:1px solid #b7c0ca;padding:6px;text-align:center;background:#fff}
.kTable th{background:#ffd6e9}
.table-scroll{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;margin-bottom:10px}
@media screen and (max-width:600px){
    .kTable{table-layout:auto}
    .kTable th,.kTable td{white-space:nowrap;min-width:100px;padding:6px 8px;font-size:13px}
    #kLines{margin-top:20px}
    .group-info-table,.group-info-table tbody,.group-info-table tr,.group-info-table th,.group-info-table td{display:block!important;width:100%!important;height:auto!important}
    .group-info-table tr{margin-bottom:0}
    .group-info-table th,.group-info-table td{text-align:left}
    .group-info-table th{background:#e7efe7}
    .kTable .btn-mini{font-size:11px;padding:4px 8px}
}
.kTable .btn-mini{display:block;margin:4px auto 0;width:fit-content}
.graphs{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;gap:2%;width:90%;margin:0 auto;max-height:60vh}
.graphs canvas{background-color:rgba(214,0,28,.06);border-radius:8px;box-shadow:0 0 8px #b5d6b5;flex:1 1 0;max-width:48%;height:auto;aspect-ratio:4/3}
@media screen and (max-width:900px){
    .graphs{flex-direction:column;align-items:center;max-height:none;gap:20px}
    .graphs canvas{max-width:100%;width:100%}
}
body.page-login{padding-top:0;justify-content:center;height:100vh}
#basic{max-width:100%;margin-left:auto;margin-right:auto}
@media screen and (max-width:600px){
    #basic,#fresh{width:100%;max-width:100%;padding:0}
}
.fresh-block,.look-wrap{border:1px solid var(--line);border-radius:12px;padding:10px;margin-top:10px;background:var(--panel);box-shadow:0 2px 0 rgba(0,0,0,.03) inset}
.block-controls{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.block-measure{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:6px}
.block-measure .label{background:var(--soft);border-radius:6px;padding:6px 10px;font-weight:600}
@media screen and (max-width:600px){
    .fresh-block{margin:10px 0;width:100%}
    .block-measure{flex-direction:column;align-items:flex-start;gap:4px}
    .block-measure .label,.block-measure .ctrl{width:100%}
    .block-measure .ctrl input{max-width:100%!important;width:100%}
}
.list{display:flex;flex-direction:column;gap:15px}
.item{display:flex;background:#fff;border:1px solid var(--line);border-radius:12px;padding:15px;gap:15px;align-items:flex-start;box-shadow:0 2px 0 rgba(0,0,0,.03);cursor:pointer;transition:transform .1s ease,box-shadow .1s ease}
.item:hover{transform:translateY(-2px);box-shadow:0 4px 6px rgba(0,0,0,.05)}
.item input[type=checkbox]{margin-top:5px;transform:scale(1.2)}
.item img{width:220px;height:220px;object-fit:contain;border-radius:8px;border:1px solid #eee;background:#333}
.item .info{flex:1;display:grid;grid-template-columns:repeat(2,1fr);column-gap:20px;row-gap:8px}
.item .info strong{grid-column:1/-1;font-size:18px;color:#2b70b6;margin-bottom:6px;border-bottom:1px solid #eee;padding-bottom:4px}
.item .info p{margin:0;font-size:13px;color:#555;line-height:1.5;display:flex}
@media screen and (max-width:600px){
    .item{flex-direction:column}
    .item img{width:100%;height:180px}
    .item .info{display:flex;flex-direction:column;gap:6px}
    .item .info strong{grid-column:auto}
}
.look-left{display:flex;flex-direction:column;gap:10px;width:100%}
.look-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.look-left textarea{width:100%;min-height:80px;padding:8px;border:1px solid #bfc7d1;border-radius:6px;background:#fff;resize:vertical;font-family:inherit}
.look-row{padding-bottom:15px;margin-bottom:15px;border-bottom:1px dashed #ccc}
.look-row:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}
.footer{width:100%;padding:20px 0;display:flex;justify-content:center;align-items:center;margin-top:40px;position:static!important}
.footer img{max-height:80px;width:auto}
.row .ctrl:has(.toggle-other-select){flex-direction:column;align-items:flex-start}
.row .ctrl:has(.toggle-other-select) .toggle-other-select,.row .ctrl:has(.toggle-other-select) .toggle-other-input{width:100%;max-width:280px}
.toggle-other-input{display:none}
.toast-big{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(.9);background:rgba(0,0,0,.85);color:#fff;padding:40px 60px;font-size:24px;font-weight:700;border-radius:14px;opacity:0;pointer-events:none;transition:all .25s ease;z-index:99999}
.toast-big.show{opacity:1;transform:translate(-50%,-50%) scale(1)}
.photo-list{max-width:100%;overflow-x:auto;overflow-y:hidden;display:flex;gap:10px;align-items:flex-start;-webkit-overflow-scrolling:touch}
.photo-list img{flex:0 0 auto;max-height:160px;width:auto;object-fit:contain;border-radius:6px}
.graph-area{width:100%;max-width:100%;margin:10px auto 0;padding:0;overflow:hidden;box-sizing:border-box}
.graph-area canvas{display:block;width:100%!important;height:100%!important}
@media (min-width:768px){.graph-area{width:80%;aspect-ratio:1.5/.8}}
@media (max-width:767px){.graph-area{width:100%;aspect-ratio:1/1.5}}
@media print{
    @page{size:A4 portrait;margin:20mm 13mm}
    header,.topbar,.tabs,.block-controls{display:none!important}
    body{background:#fff!important;padding:0!important;margin:0!important}
    .tab-content{display:block!important;margin:0}
    .card,.look-rows,table,tr,th,td,img,canvas{break-inside:avoid-page;page-break-inside:avoid}
    table{width:100%;table-layout:fixed}
    th{width:25mm!important;background:#f2f2f2!important}
    .graphs{width:100%;max-height:none}
    .graphs canvas{max-width:48%;box-shadow:none;height:100%!important}
    .graphs-row{display:flex!important;flex-wrap:wrap!important;gap:16px!important;width:100%!important;max-width:100%!important;margin:0!important}
    .graph-block{flex:0 0 calc(50% - 8px)!important;max-width:calc(50% - 8px)!important;width:auto!important;min-width:0!important;break-inside:avoid!important;page-break-inside:avoid!important}
    .graph-area{width:100%!important;height:110mm!important;margin:0!important;overflow:hidden!important}
    .graph-area canvas{display:block!important;width:100%!important;height:100%!important}
    .graphs-row,.graph-block,.graph-area,.group-info-table,.kTable,.photo-table,.look-table,.app-table{width:100%!important;max-width:100%!important;margin-left:0!important;margin-right:0!important}
}
@media print{
    /* 既存の印刷設定はそのまま活かしつつ、グラフだけ「縦並び＆固定サイズ」にする */

    /* 横並びコンテナを無効化（1つずつ縦に並べる） */
    .graphs-row{
        display:block !important;
        flex-wrap:unset !important;
        gap:0 !important;
        width:100% !important;
        max-width:100% !important;
        margin:0 !important;
    }

    /* 1グラフ=横幅100%（2列割りを解除） */
    .graph-block{
        display:block !important;
        flex:none !important;
        max-width:100% !important;
        width:100% !important;
        min-width:0 !important;
        margin:0 0 8mm !important; /* 次のグラフとの間隔 */
        break-inside:avoid !important;
        page-break-inside:avoid !important;
    }

    /* 印刷時のグラフ表示領域を固定（PC/スマホで同じサイズ） */
    .graph-area{
        width:100% !important;
        height:110mm !important;   /* ←ここを好みで調整（例: 100〜125mm） */
        margin:0 !important;
        overflow:hidden !important;
        aspect-ratio:auto !important;
    }

    /* canvasを“絶対に潰さない”固定寸法で印刷 */
    .graph-area canvas,
    .graphs canvas{
        display:block !important;
        width:100% !important;
        height:110mm !important;   /* graph-area と揃える */
        max-width:100% !important;
        max-height:none !important;
        box-shadow:none !important;
        aspect-ratio:auto !important;
    }

    /* もし .graphs を使ってる画面があれば、印刷時は縦に */
    .graphs{
        display:block !important;
        width:100% !important;
        max-height:none !important;
        margin:0 !important;
        gap:0 !important;
    }
}
@media print {

    /* 横並び完全解除（必ず縦並び） */
    .graphs-row{
        display:block !important;
    }

    .graph-block{
        display:block !important;
        width:100% !important;
        max-width:100% !important;
        flex:none !important;
        margin:0 0 10mm !important;
    }

    /* ★印刷時は絶対固定サイズ（PC/スマホ共通） */
    .graph-area{
        width:100% !important;
        height:110mm !important;   /* ←ここがポイント */
        aspect-ratio:auto !important;
    }

    .graph-area canvas{
        width:100% !important;
        height:110mm !important;   /* 親と同じ高さに固定 */
        aspect-ratio:auto !important;
    }

    /* 既存の .graphs canvas の影響を消す */
    .graphs canvas{
        height:110mm !important;
        max-width:100% !important;
        aspect-ratio:auto !important;
    }
}
@media print{
    /* 横並び解除：必ず縦に1つずつ */
    .graphs-row{
        display:block !important;
        flex-wrap:unset !important;
        gap:0 !important;
    }
    .graph-block{
        display:block !important;
        width:100% !important;
        max-width:100% !important;
        flex:none !important;
        margin:0 0 10mm !important;
        break-inside:avoid !important;
        page-break-inside:avoid !important;
    }

    /* ★印刷サイズをPC/スマホで統一（mm固定） */
    .graph-area{
        width:100% !important;
        height:110mm !important;
        overflow:hidden !important;
        aspect-ratio:auto !important;
    }

    /* canvasは必ず親にフィット（比率指定は殺す） */
    .graph-area canvas{
        display:block !important;
        width:100% !important;
        height:100% !important;
        max-width:100% !important;
        max-height:none !important;
        aspect-ratio:auto !important;
    }

    /* 既存の .graphs canvas ルールを無効化（残ってても潰さない） */
    .graphs,
    .graphs canvas{
        width:100% !important;
        height:auto !important;
        max-height:none !important;
        aspect-ratio:auto !important;
    }
}
@media print{
    .graphs-row{ display:block !important; }
    .graph-block{ width:100% !important; max-width:100% !important; flex:none !important; }

    .graph-area{ width:100% !important; height:110mm !important; }
    .graph-area canvas{ width:100% !important; height:100% !important; }
}
.toggle-btn{
    background:#f5f7f9;
    border:1px solid #cfd6dd;
    padding:6px 14px;
    border-radius:6px;
    cursor:pointer;
    margin-bottom:10px;
}
#searchCard{
    overflow:hidden;
    transition:max-height 0.6s ease;
    max-height:1000px;
}

#searchCard.is-closed{
    max-height:0;
}
