html {
 font-size: 100%;
 }
body {
  font-family: 'M PLUS 1p', sans-serif;
  font-weight: 500;
  background-color: #f0f0f0;
  padding: 20px;
  font-size: 0.875em;
  color: #333;
  transform: rotate(0.05deg);
}
h1, h2{
  text-align: center;
}
h1 {
  color: #222;
  font-size: 1.8em;
  margin: 1em;
  font-weight: 700;
}

h1, h2, th, nav ,button, .delete-button, .custom-button {
 user-select: none;  /* さわらせない */
}

a {
  text-decoration: none;
  color: #ff5722;
}

a:hover {
  text-decoration: none;
  color: #ff5722;
}

nav {
  text-align: center;
}

.dialog-error {
  background-color: #ffeaea;
  border: 1px solid #cc0000;
  color: #cc0000;
  padding: 1em;
  border-radius: 8px;
  max-width: 400px;
  margin: 1em auto;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 貸借表などのメインテーブル */
.main-table {
  font-size: 0.8125em;  /* 13px相当（16×0.8125） */
  width: 100%;
  background-color: #fff;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  max-width: 1280px;
  margin: 0 auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  background-color: #fff;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
  max-width: 1440px;
  margin: 0 auto;
}

th, td {
  padding: 6px 15px;
  border: 1px solid #ddd;
}

th {
  font-size: 1.25em;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  background-color: #f8f9fa;
  text-align: center;
}

td {
  vertical-align: middle;
}

td.stock-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

td.stock-controls form {
  margin: 0;
}

td.stocker_cell .ajax-button {
  padding: 4px 10px;
  font-size: 0.9em;
}

.stocker_cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.stocker_cell .count-text {
  font-size: 1.2em;
  font-weight: bold;
  margin: 0.25em 0;
  transition: color 0.2s ease;
  min-width: 2em;
}

.delete-button {
  background-color: #D9394E;
  color: white;
  font-weight: bold;
  border: none;
  padding: 9px 12px;
  border-radius: 4px;
  cursor: pointer;
}

button {
  padding: 9px 12px;
  font-size: 0.9em;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  border: none;
  border-radius: 4px;
  background-color: #666;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
  height: 3em;
}

button:hover {
  background-color: #555;
}

.delete-button:hover {
  background-color: #b62e40;
}

/* フォーム */

label.form-label {
  display: inline-block;
  font-size: 1.2em;
  letter-spacing: 0.1em;
  user-select: none;
}

form.edit-form {
  max-width: 600px;
  margin: 0 auto;
  background-color: #fff;
  padding: 20px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

form.edit-form p {
  margin-bottom: 15px;
  text-align: center;
}

form.edit-form input,
form.edit-form button {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  font-size: 1.2em;
  padding: 12px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

form.edit-form input {
  border: 1px solid #ccc;
}

form.edit-form input:focus {
  border-color: #999;
  outline: none;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 1em;
    border: 1px solid #ddd;
    border-radius: 16px;
    background-color: #fff;
    padding: 10px;
  }

  td {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border: none;
    border-bottom: 1px solid #eee;
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    font-weight: bold;
    flex-basis: 50%;
    text-align: left;
  }
}
.form-row {
  display: flex;
  gap: 10px;
}

.form-row input,
.form-row select {
  flex: 1;
  padding: 6px;
  font-size: 1em;
}

/* ロゴ */
.header-logo {
  display: block;
  max-width: 300px;
  height: auto;
  margin: 0 auto 20px auto;
}

@media (max-width: 768px) {
  .header-logo {
    max-width: 200px;
  }
}

/* ボタンスタイル */
.custom-button {
  background-color: #ff5722;
  color: #fff;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.3s ease;
}

.custom-button:hover {
  background-color: #e64a19;
}

/* ボタン中央揃え用 */
.center-button {
  text-align: center;
  margin: 20px 0;
}


/* 表の在庫数・更新日時・編集列の中央揃え */
td:nth-child(2),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7) {
  text-align: center;
}

.chart-container {
  max-width: 800px;
  margin: 0 auto 40px auto;
}

.unit {
 font-size: 0.925em;
 font-weight: 900;
 margin-left: 0.2em;
}

.stocker {
 min-width: 2em;
 display: inline-block;
}

/* 貸出管理 */
.search-controls {
 max-width: 1440px;
 margin: 0 auto;
}

.search-box {
 width: 100%;
 padding: 6px;
}
#search {
 display: block;
 font-size: 1em;
 padding: 0.5em;
 margin: 0 auto;
}
.radio_switch {
 display: flex;
 justify-content: space-evenly;
 list-style: none;
 padding-left: 0;
}
radio_switch > li {
 margin: 15px 0;
}

/*  貸借表 */
.loan-in  { color: red; }
.loan-out { color: blue; }
.date-cell {
  line-height: 1.1;
  text-align: center;
  font-size: 0.8em;
}
/* ==== 操作ボタン（確認・削除） ==== */
.op-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  background: transparent !important;   /* ← グローバルbutton色リセット */
  color: #000 !important;               /* ← テキストカラー上書き */
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.op-btn:hover, .op-btn:focus {
  background: transparent !important;
}

/* ==== 未確認：空枠 + ホバーで✔ ==== */
.op-btn.is-unconfirmed .box {
  position: absolute;
  inset: 0;
  border: 1px solid #aaa;
  border-radius: 3px;
}
.op-btn.is-unconfirmed .icon.check {
  opacity: 0;              /* ← 空枠のみ表示 */
  transition: opacity .12s;
}
.op-btn.is-unconfirmed:hover .icon.check,
.op-btn.is-unconfirmed:focus-visible .icon.check {
  opacity: 1;
  color: #000;             /* ← ホバーで黒✔ */
}
/* グレーの✔を常時出したい場合は上の opacity:0 を以下で置換
   .op-btn.is-unconfirmed .icon.check { opacity:1; color:#bbb; } */

/* ==== 確認済：平時✔、ホバーで✖ ==== */
.op-btn.is-confirmed .icon.done {
  display: inline;
  color: #000;
}
.op-btn.is-confirmed .icon.del {
  display: none;
  color: #c00;
}
.op-btn.is-confirmed:hover .icon.done,
.op-btn.is-confirmed:focus-visible .icon.done {
  display: none;
}
.op-btn.is-confirmed:hover .icon.del,
.op-btn.is-confirmed:focus-visible .icon.del {
  display: inline;
}

.delete-icon-button {
  background: none;
  border: none;
  font-size: 1.25em;
  cursor: pointer;
  padding: 0;
  color: #d33;
}

td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(7),
td:nth-child(8) {
  text-align: center;
}

.delete-icon-button:hover {
  color: #a00;
}

.choices {
  margin-bottom: 0 !important;
}

form.edit-form input.form_loan,
.choices__inner,
#category_other {
  margin:6px auto;
}

.unpaid-category {
  max-width: 400px;
  margin: 0 auto;
}

.choices__inner,
#category_other {
  color: #666;
  padding: 6px 10px;
  width: 100%;
  box-sizing: border-box;
}

.choices__list--single {
  padding: 0;
}

/* ソートボタン */
th[onclick], th[onclick]:hover {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

th[onclick]:hover {
  background-color: #ffb899;
}

/* 疑義照会 */
.container {
  max-width: 800px;
  margin: auto;
  background: white;
  padding: 1.5em;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

table.calendar {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2em;
  vertical-align: top;
}

table.calendar th {
  font-size: 0.9em;
  line-height: 1.2;
  border: 1px solid #ccc;
  text-align: center;
  height: 2em;
  padding: 4px 0;
  vertical-align: middle;
}

table.calendar td {
  font-size: 0.9em;
  line-height: 1.3;
  border: 1px solid #ccc;
  text-align: center;
  padding: 8px 6px;
  height: 5em;
}

.nav-links {
  text-align: center;
  margin-bottom: 1em;
  font-weight: 600;
  font-size: 1.1em;
  user-select: none;
}

.nav-links a {
  margin: 0 0.5em;
  color: #ff7043;
  text-decoration: none;
}

.nav-links a:hover {
  color: #ff5722;
  text-decoration: none;
  transition: color 0.2s ease;
}

.today-box {
  text-align: center;
  margin-top: 2em;
}

.count-controls {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 4px 0 0 0;
}
.count-controls form {
  margin: 0;
}

.count-controls button {
  all: unset; /* ボタンの見た目を完全にリセット */
  font-size: 1.1em;
  font-weight: bold;
  color: #555;
  padding: 0 0.5em;
  cursor: pointer;
  transition: color 0.2s ease;
}

.count-controls button:hover {
  color: #d33;
}

.calendar th:first-child {
  color: #d33;
  background-color: #ffeaea;
}

td.sunday, td.holiday {
  background-color:  #ffeaea;
  color: #d00
}

td.today {
  background-color: #fffae6;
  border: 2px solid #f7c948;
  box-shadow: 0 0 5px #f7c948;
}

td.today div:first-child {
  font-weight: bold;
  color: #ff9422;
}

td.future {
  background-color: #eee;
  color: #999;
}

td.future .disabled-text {
  font-size: 0.9em;
  color: #aaa;
}

.disabled-button {
  all: unset;
  font-size: 1.1em;
  font-weight: bold;
  color: #ccc;
  padding: 0 0.5em;
  cursor: not-allowed;
}

.disabled-button:hover {
  box-shadow: none;
}

/* 日付セル構造 */
.calendar-day {
  font-size: 0.8em;
  color: #666;
  margin-bottom: 0.25em;
}

.count-badge {
  display: inline-block;
  padding: 4px 12px;
  background-color: #ff7f50;
  color: #fff;
  border-radius: 999px;
  font-weight: bold;
  font-size: 1.2em;
  margin: 6px 0;
}

#today_result {
  font-weight: bold;
  font-size: 2em;
}


.big-button {
  font-size: 1.2em;
  padding: 0.5em 1.5em;
  background-color: #b22222;
  height: 3em;
}

input#date_input {
  background-image: url('https://cdn-icons-png.flaticon.com/512/747/747310.png');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 1em;
  padding-right: 2.5em;
}

ul.weekday-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  list-style: none;
  padding-left: 0;
  font-size: 1em;
}

.count-text {
  font-size: 1.3em;
  font-weight: bold;
  margin: 0.25em 0;
  transition: color 0.2s ease;
}

.count-zero {
  color: #bbb;
}

.count-low {
  color: #ffcc80;
}

.count-mid {
  color: #ffa726;
}

.count-high {
  color: #fb8c00;
}

.count-peak {
  color: #e53935;
}

table.calendar .weekly-summary-row td {
  background-color: #fafafa;
  font-size: 0.75em;
  text-align: center;
  padding: 0.2em 0;
  border-top: 2px solid #ccc;
  font-weight: 500;
  line-height: 1.2;
  }

.weekly-summary-label {
  color: #999;
  margin-right: 2px;
}

.weekly-summary-count {
  font-weight: bold;
  color: #444;
}

.summary-sunday {
  color: #d33;
}
