/* === カラーパレット（変数化して管理しやすく） === */
:root {
  --bg-light-blue: #eff5f8;   /* 全体背景：薄い水色 */
  --main-pink: #eaaebf;       /* ボタン等：落ち着いた薄ピンク */
  --main-pink-hover: #d99aa8;
  --sub-blue: #b3d1df;        /* サブボタン等：落ち着いた水色 */
  --sub-blue-hover: #9ebfd0;
  --text-main: #4a4a4a;       /* 文字色：柔らかいダークグレー */
  --text-accent: #b45e76;     /* 強調色：濃いめのピンク */
  --container-bg: #ffffff;
  --result-bg: #fcf4f6;       /* 結果エリア背景：極薄いピンク */
  --table-th-bg: #eaf1f5;     /* テーブル見出し：薄い水色 */
  --border-color: #d8e0e5;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg-light-blue);
  margin: 0;
  padding: 20px;
  color: var(--text-main);
  line-height: 1.6;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  background: var(--container-bg);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

/* ヘッダー周り */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--border-color);
}

.header-row h1 {
  font-size: 24px;
  margin: 0;
  color: var(--text-main);
}

/* フォーム要素 */
label {
  display: block;
  font-weight: bold;
  margin: 16px 0 8px;
  color: var(--text-main);
}

select, input[type="date"], input[type="password"], input[type="text"] {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: #fdfdfd;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--sub-blue);
}

/* ボタン共通 */
button {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

/* メインアクションボタン */
.btn-main {
  margin-top: 24px;
  background: var(--main-pink);
  color: #fff;
  box-shadow: 0 4px 10px rgba(234, 174, 191, 0.3);
}

.btn-main:hover {
  background: var(--main-pink-hover);
  transform: translateY(-2px);
}

/* サブボタン（設定など） */
.settings-btn {
  width: auto;
  min-width: 80px;
  height: 44px;
  padding: 0 20px;
  background: var(--sub-blue);
  color: #fff;
  margin-top: 0;
  box-shadow: 0 4px 10px rgba(179, 209, 223, 0.3);
}

.settings-btn:hover {
  background: var(--sub-blue-hover);
  transform: translateY(-2px);
}

/* メモ・注意書き */
.note {
  margin-top: 20px;
  font-size: 13.5px;
  color: #6d757a;
  line-height: 1.8;
  background: #f8fbfc;
  padding: 12px 16px;
  border-radius: 8px;
}

/* 状態表示（ローディング・エラー） */
.loading {
  margin-top: 20px;
  display: none;
  color: var(--sub-blue-hover);
  font-weight: bold;
  text-align: center;
}

.error {
  margin-top: 20px;
  padding: 16px;
  background: #fce8e8;
  color: #c93b3b;
  border-radius: 10px;
  display: none;
  font-weight: bold;
}

/* 結果表示エリア */
.result {
  margin-top: 30px;
  padding: 24px;
  border-radius: 14px;
  background: var(--result-bg);
  display: none;
  border: 1px solid #f2e3e7;
}

.result > div {
  margin-bottom: 6px;
  font-size: 15px;
}

/* 目安日の強調デザイン */
.due-label {
  margin-top: 24px;
  margin-bottom: 8px;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--text-accent);
  letter-spacing: 2px;
}

.due {
  font-size: 36px;
  font-weight: 900;
  margin: 0 0 24px;
  color: var(--text-accent);
  text-align: center;
  background: linear-gradient(135deg, #fff 0%, #fef3f5 100%);
  padding: 20px;
  border-radius: 12px;
  border: 3px solid var(--main-pink);
  box-shadow: 0 6px 16px rgba(234, 174, 191, 0.4);
}

/* テーブル共通・レスポンシブ対応 */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  min-width: 500px;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 12px 8px;
  text-align: center;
}

th {
  background: var(--table-th-bg);
  color: var(--text-main);
  font-weight: bold;
}

.business {
  background: #fff;
}

.closed {
  background: #f7f9fa;
  color: #90989d;
}

/* モーダル（設定画面） */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.modal-box {
  max-width: 900px;
  margin: 20px auto;
  background: #fff;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  color: var(--sub-blue-hover);
}

.close-btn {
  width: auto;
  padding: 8px 16px;
  background: #ccc;
  color: #fff;
  border-radius: 8px;
}
.close-btn:hover { background: #b3b3b3; }

.admin-pin-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.admin-pin-row input { flex: 1; }
.admin-pin-row button { width: 100px; background: var(--sub-blue); color: #fff; margin-top: 0; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
}

.admin-tabs button {
  width: auto;
  margin-top: 0;
  padding: 10px 18px;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.admin-tabs button.active {
  background: var(--sub-blue);
  color: #fff;
  border-color: var(--sub-blue);
}

.admin-table input {
  width: 100%;
  border: 1px solid transparent;
  padding: 8px;
  font-size: 14px;
  box-sizing: border-box;
  border-radius: 4px;
  background: #fdfdfd;
}
.admin-table input:focus { border-color: var(--sub-blue); }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.admin-actions button {
  width: auto;
  margin-top: 0;
  padding: 12px 24px;
}

.delete-row-btn {
  background: #e59393;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.delete-row-btn:hover { background: #d67a7a; }

.save-btn {
  background: var(--main-pink);
  color: #fff;
}
.save-btn:hover { background: var(--main-pink-hover); }

/* === レスポンシブ対応（タブレット・スマホ向け） === */
@media screen and (max-width: 768px) {
  body {
    padding: 12px;
  }
  .container {
    padding: 20px;
  }
  .header-row h1 {
    font-size: 20px;
  }
  
  /* 目安日をスマホ画面に合わせて少し調整 */
  .due {
    font-size: 28px;
    padding: 16px;
  }

  .settings-btn {
    height: 38px;
    font-size: 14px;
    padding: 0 16px;
  }
  select, input[type="date"], input[type="password"], input[type="text"] {
    padding: 12px;
    font-size: 15px;
  }
  button {
    padding: 12px;
  }

  /* スマホ向け：結果テーブルの特定の列を非表示にする */
  /* 3列目(祝日)、4列目(技工所休業)、5列目(判定)を隠す */
  #resultTable th:nth-child(3), #resultTable td:nth-child(3),
  #resultTable th:nth-child(4), #resultTable td:nth-child(4),
  #resultTable th:nth-child(5), #resultTable td:nth-child(5) {
    display: none;
  }
  
  /* 列が減った分、最小幅を解除して画面にフィットさせる */
  #resultTable {
    min-width: auto;
  }

  .modal-box {
    padding: 20px;
    margin: 10px;
  }
  .admin-pin-row {
    flex-direction: column;
  }
  .admin-pin-row button {
    width: 100%;
  }
}
