:root{
  --date-col: 42px; --weekday-col: 30px; --check-col: 0px;
  --name-h: 46px; --field-h: 42px; --row-h: 40px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:#f7f8fb; color:#222; height:100vh; overflow:hidden;
}
.toolbar{
  position:sticky; top:0; z-index:200; background:#fff;
  border-bottom:1px solid #d9deea; padding:12px;
}
.toolbar-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:10px}
.toolbar-row:last-child{margin-bottom:0}
.toolbar button{
  border:1px solid #b9c7e4;background:#fff;color:#2a6edb;border-radius:12px;
  padding:10px 14px;font-size:16px;
}
.toolbar button.secondary{color:#444;border-color:#cfd7e7}
.toolbar input[type="number"], .toolbar input[type="text"]{
  width:88px;height:42px;border:1px solid #cfd7e7;border-radius:10px;
  padding:0 10px;font-size:18px;background:#fff;
}
.hint,.save-state{color:#667085;font-size:14px}
.page-title{font-size:18px;font-weight:700;color:#1f3a6e}
.summary-bar,.employee-summary-bar{
  display:flex;gap:12px;padding:12px;background:#f7f8fb;
}
.summary-card{
  background:#fff;border:1px solid #d9deea;border-radius:14px;padding:12px 14px;min-width:230px;
}
.summary-label{font-size:13px;color:#667085;margin-bottom:6px}
.summary-input{
  width:150px;height:42px;border:1px solid #cfd7e7;border-radius:10px;
  padding:0 10px;font-size:22px;font-weight:700;color:#1f3a6e;background:#fff;
}
.company-input{ width:240px; font-size:18px; }
.sheet-shell{padding:0 12px 12px 12px;height:calc(100vh - 118px);overflow:hidden}
.sheet-layout{
  display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;
  border:1px solid #d9deea;border-radius:14px;overflow:hidden;background:#fff;height:100%;
}
.corner-wrap{grid-column:1;grid-row:1;z-index:5;background:#fff;border-right:1px solid #cfd7e7;border-bottom:1px solid #cfd7e7}
.top-wrap{grid-column:2;grid-row:1;overflow:hidden;z-index:4;background:#fff;border-bottom:1px solid #cfd7e7}
.left-wrap{grid-column:1;grid-row:2;overflow:hidden;z-index:4;background:#fff;border-right:1px solid #cfd7e7}
.body-wrap{grid-column:2;grid-row:2;overflow:auto;-webkit-overflow-scrolling:touch;background:#fff;overscroll-behavior:contain}
table{border-collapse:collapse;table-layout:fixed;background:#fff}
th,td{border:1px solid #cfd7e7;font-size:16px;padding:4px 6px;text-align:center;vertical-align:middle;background:#fff}
thead th{background:#f2f5fb;font-weight:700}
.name-row th{height:var(--name-h)} .field-row th{height:var(--field-h)}
.body-table td,.left-table td{height:var(--row-h)}
.date-col{width:var(--date-col);min-width:var(--date-col);max-width:var(--date-col)}
.weekday-col{width:var(--weekday-col);min-width:var(--weekday-col);max-width:var(--weekday-col)}
.check-col{width:var(--check-col);min-width:var(--check-col);max-width:var(--check-col)}
.left-table tr.sat td,.employee-entry-table tr.sat td,.report-table tr.sat td{background:#f5eee8}
.left-table tr.sun td,.employee-entry-table tr.sun td,.report-table tr.sun td{background:#f8e6e6}
.left-table tr.today td,.employee-entry-table tr.today td{background:#eaf5ee}
input.cell-input,select.cell-input{
  width:100%;border:none;outline:none;background:transparent;font-size:15px;text-align:left
}
input.cell-input.num{text-align:right}
.cell-check{width:22px;height:22px}
.employee-name-btn{
  display:block;width:100%;background:transparent;border:none;padding:0;margin:0;
  font:inherit;font-weight:700;color:#1f3a6e;cursor:pointer;
}
dialog{border:none;border-radius:12px;padding:0}
.dialog-form{padding:18px;min-width:340px;display:flex;flex-direction:column;gap:12px}
.dialog-form input,.dialog-form select{width:100%;height:40px;border:1px solid #cfd7e7;border-radius:8px;padding:0 10px}
menu{display:flex;justify-content:flex-end;gap:8px;padding:0;margin:0}
.employee-list,.field-list{display:flex;flex-direction:column;gap:8px;max-height:320px;overflow:auto;padding-right:4px}
.employee-row,.field-row-manage{display:grid;grid-template-columns:1fr auto auto auto;gap:8px;align-items:center}
.employee-row button,.field-row-manage button{border:1px solid #cfd7e7;background:#fff;border-radius:10px;padding:8px 10px;color:#444}
.field-meta{color:#667085;font-size:13px}
.employee-page,.report-page{overflow:auto}
.employee-table-wrap{
  padding:12px;
  height:calc(100vh - 180px);
  overflow:auto;
}
.employee-entry-table{ width:max-content; min-width:100%; }
.report-table td input{
  width:100%; border:none; outline:none; background:transparent; text-align:left; font-size:16px;
}
.report-header{ padding:16px 12px 0 12px; }
.report-header h1{ margin:0 0 8px 0; font-size:28px; }
.report-ym{ color:#667085; font-size:16px; }
.report-wrap{ height:calc(100vh - 210px); }
.status-bar{padding:10px 12px; color:#667085; font-size:14px}
@media print{
  body{ overflow:visible; height:auto; background:#fff; }
  .no-print{ display:none !important; }
  @page{ size:A4 portrait; margin:5mm; }
  .report-page{ zoom:0.62; transform-origin:top left; }
  .report-header{ padding:0 0 2mm 0 !important; }
  .report-header h1{ font-size:16pt !important; margin:0 0 1mm 0 !important; line-height:1.05 !important; }
  .report-ym{ font-size:9pt !important; line-height:1 !important; margin:0 !important; }
  .report-wrap,.employee-table-wrap{ height:auto !important; overflow:visible !important; padding:0 !important; }
  .report-table{ width:100% !important; }
  .report-table th,.report-table td{
    font-size:7.5pt !important; padding:0.6mm 1mm !important; line-height:1 !important; height:4.2mm !important; min-height:4.2mm !important;
  }
  .report-table input{ font-size:7.5pt !important; line-height:1 !important; padding:0 !important; height:auto !important; }
}


.bulk-days{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
#bulkFields{
  display:flex;
  flex-direction:column;
  gap:10px;
}
#bulkFields .bulk-row{
  display:grid;
  grid-template-columns:110px 1fr;
  gap:10px;
  align-items:center;
}
.pdf-note{
  color:#667085;
  font-size:13px;
}

#bulkEmployee{
  height:auto !important;
  min-height:180px;
}


/* v5 preview fix */
#previewTable th:first-child,
#previewTable td:first-child{
  width:60px !important;
  min-width:60px !important;
  max-width:60px !important;
  white-space:nowrap;
}
#previewTable th:nth-child(2),
#previewTable td:nth-child(2){
  width:38px !important;
  min-width:38px !important;
  max-width:38px !important;
  white-space:nowrap;
}
#previewTable{
  table-layout:fixed;
}
#previewTable td{
  overflow-wrap:anywhere;
}

/* v6: 日報印刷用の日付・曜日列幅固定 */
.report-table th:nth-child(1),
.report-table td:nth-child(1),
#reportTable th:nth-child(1),
#reportTable td:nth-child(1){
  width:42px !important;
  min-width:42px !important;
  max-width:42px !important;
  white-space:nowrap;
}
.report-table th:nth-child(2),
.report-table td:nth-child(2),
#reportTable th:nth-child(2),
#reportTable td:nth-child(2){
  width:30px !important;
  min-width:30px !important;
  max-width:30px !important;
  white-space:nowrap;
}

/* v7: PDF表示の列幅補正 */
#previewTable{
  table-layout: fixed !important;
  width: auto !important;
}
#previewTable th,
#previewTable td{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 左2列 */
#previewTable th:first-child,
#previewTable td:first-child{
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
}
#previewTable th:nth-child(2),
#previewTable td:nth-child(2){
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
}

/* 1人目の項目幅 */
#previewTable th:nth-child(3),
#previewTable td:nth-child(3){
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
}
#previewTable th:nth-child(4),
#previewTable td:nth-child(4){
  width: 140px !important;
  min-width: 140px !important;
  max-width: 140px !important;
}

/* v8: PDF表示の人工列は全部40、他項目は通常幅を使う */
#previewTable th,
#previewTable td{
  white-space: nowrap;
}
