:root {
  --main-orange: #ff9f43;
  --orange-hover: #ff7f1a;
  --light-orange: #fff3e6;
  --panel-border: #ffd9b3;
  --text-dark: #444;
}

/* 全体レイアウト */
body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  gap: 20px;
  background: #fafafa;
  color: var(--text-dark);
}



/* A4本体 */
#a4 {
  width: 210mm;
  height: 297mm;
  background: white;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(0,0,0,0.15);
  position: relative;
  top: 0;
  transform-origin: top left;
}

/* 表の枠（編集時のみ見える） */
.cell {
  position: absolute;
  border: 1px dashed #ccc;
  font-size: 8pt;
  color: #aaa;
  pointer-events: none;
}

/* 入力欄（contenteditable） */
.cellInput {
  position: absolute;
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  height: 100%;
  padding: 2px 4px;
  box-sizing: border-box;
  font-size: 12pt;
  overflow: hidden;

  display: flex;
  align-items: center; /* 縦方向（初期値＝中央） */
  justify-content: flex-start; /* 横方向（初期値＝左） */

  white-space: nowrap;
}

/* 横方向の揃え */
.cellInput.left {
  justify-content: flex-start;
}
.cellInput.center {
  justify-content: center;
}
.cellInput.right {
  justify-content: flex-end;
}

/* 縦方向の揃え */
.cellInput.top {
  align-items: flex-start;
}
.cellInput.middle {
  align-items: center;
}
.cellInput.bottom {
  align-items: flex-end;
}

/* 選択中の入力欄 */
.selected {
  outline: 2px solid var(--main-orange);
  outline-offset: -2px;
}

/* 右側パネル（独立スクロール） */
#panel {
  width: 260px;
  background: var(--light-orange);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);

  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

/* パネル見出し */
#panel h3 {
  margin-top: 20px;
  color: var(--main-orange);
}

/* 入力欄 */
#panel input[type="number"],
#panel input[type="text"],
#panel select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* ボタン */
button {
  background: var(--main-orange);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: 0.2s;
}

button:hover {
  background: var(--orange-hover);
  transform: translateY(-2px);
}

/* 印刷用CSS */
@media print {

  body {
    margin: 0;
    padding: 0;
  }

  #panel {
    display: none;
  }

  #a4-wrapper {
    overflow: visible;
  }

  #a4 {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    transform: scale(1) !important;
  }

  .cell {
    border: none !important;
    color: transparent !important;
  }

  .selected {
    outline: none !important;
  }
}


#scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  flex: 1;
  min-width: 0; 
}


#a4-wrapper {
  width: max-content;

}

#center-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}