/* ===== リセット ===== */
*, *::before, *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== ベース ===== */
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  background: #f0f0f0;
  color: #1a1a1a;
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  line-height: 1.6;
}

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: 18px;
}

/* ===== PINスクリーン ===== */
#pin-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #f0f0f0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  z-index: 100;
}

.pin-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 40px 28px;
  width: 300px;
  max-width: 90%;
  text-align: center;
}

.pin-box h1 {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.pin-box p {
  font-size: 15px;
  color: #666;
  margin-bottom: 20px;
}

.pin-box input[type="password"] {
  width: 100%;
  padding: 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 22px;
  text-align: center;
  margin-bottom: 14px;
  outline: none;
}

.pin-box input[type="password"]:focus {
  border-color: #0066cc;
}

.pin-box .pin-btn {
  width: 100%;
  padding: 16px;
  background: #0066cc;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
}

.pin-box .pin-btn:active {
  background: #0052a3;
}

.pin-error {
  margin-top: 12px;
  font-size: 15px;
  color: #cc0000;
}

/* ===== ヘッダー（input.html用） ===== */
.header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 14px 18px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  font-size: 16px;
  font-weight: bold;
  color: #444;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 18px;
  font-weight: bold;
  color: #1a1a1a;
}

/* ===== メインコンテンツ ===== */
.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 14px;
}

/* ===== セクションカード ===== */
.section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: bold;
  color: #888;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

/* ===== 吸引セクション ===== */
.count-area {
  font-size: 17px;
  color: #444;
  margin-bottom: 14px;
}

.count-area .count-num {
  font-size: 40px;
  font-weight: 300;
  color: #0066cc;
  margin: 0 4px;
}

/* 空振りトグル */
.toggle-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: bold;
  background: #f0f0f0;
  color: #555;
  border: 2px solid #ccc;
  border-radius: 10px;
  margin-bottom: 12px;
  min-height: 52px;
}

.toggle-btn.on {
  background: #fff3cd;
  color: #7a5c00;
  border-color: #e0a800;
}

.toggle-btn:active {
  opacity: 0.8;
}

/* 詳細（量・色・粘度）グリッド */
.detail-grid {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-item {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  color: #888;
  font-weight: bold;
  letter-spacing: 0.04em;
}

.detail-item select {
  width: 100%;
  padding: 10px 6px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background: #f9f9f9;
  color: #333;
  min-height: 48px;
}

/* +1 / -1 ボタン行 */
.suction-btns {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 10px;
}

.suction-btns .big-btn {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  margin-bottom: 0;
}

.big-btn {
  width: 100%;
  padding: 24px 16px;
  font-size: 26px;
  font-weight: bold;
  background: #0066cc;
  color: #fff;
  border: none;
  border-radius: 14px;
  margin-bottom: 14px;
  min-height: 80px;
  letter-spacing: 0.05em;
}

.big-btn:active {
  background: #0052a3;
}

.big-btn:disabled {
  background: #9ab8d8;
}

/* -1 戻すボタン */
.minus-btn {
  padding: 0 18px;
  font-size: 17px;
  font-weight: bold;
  background: #f0f0f0;
  color: #555;
  border: 2px solid #ccc;
  border-radius: 14px;
  min-height: 80px;
  min-width: 90px;
  white-space: nowrap;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.minus-btn:active {
  background: #e0e0e0;
}

.minus-btn:disabled {
  opacity: 0.4;
}

.detail-area {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: #555;
}

.detail-area select {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background: #f9f9f9;
  color: #333;
  min-width: 120px;
  min-height: 44px;
}

/* ===== 入力行 ===== */
.input-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.input-row:last-child {
  margin-bottom: 0;
}

.input-row label {
  font-size: 16px;
  font-weight: bold;
  color: #555;
  min-width: 50px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.input-row input[type="number"],
.input-row input[type="text"] {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  padding: 13px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 20px;
  min-height: 52px;
  outline: none;
  color: #1a1a1a;
}

.input-row input:focus {
  border-color: #0066cc;
}

.input-row .unit {
  font-size: 16px;
  color: #888;
  min-width: 28px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

/* ===== 保存ボタン ===== */
.save-btn {
  padding: 13px 18px;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  min-height: 52px;
  white-space: nowrap;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.save-btn:active {
  background: #222;
}

.save-btn:disabled {
  background: #aaa;
}

.save-btn.full {
  width: 100%;
  margin-top: 12px;
  padding: 16px;
  font-size: 18px;
  min-height: 56px;
}

/* ===== テキストエリア ===== */
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  outline: none;
  color: #1a1a1a;
  line-height: 1.6;
}

textarea:focus {
  border-color: #0066cc;
}

textarea::placeholder {
  color: #bbb;
}

/* ===== ステータスメッセージ ===== */
.status-msg {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 17px;
  text-align: center;
  margin-top: 12px;
}

/* ===== グラフカード ===== */
.chart-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.chart-card-title {
  padding: 12px 18px 8px;
  font-size: 13px;
  font-weight: bold;
  color: #888;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f0f0f0;
}

.chart-wrap {
  padding: 8px 12px 4px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  text-align: center;
  padding: 24px;
  color: #bbb;
  font-size: 14px;
}

/* ===== ダッシュボード ===== */
.dash-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-header-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dash-header-top h1 {
  font-size: 20px;
  font-weight: bold;
}

.dash-link {
  font-size: 14px;
  color: #0066cc;
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid #0066cc;
  border-radius: 8px;
}

.date-nav {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 50%;
  font-size: 20px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  color: #444;
  cursor: pointer;
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-btn:active:not(:disabled) {
  background: #f0f0f0;
}

.date-display {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: bold;
  color: #1a1a1a;
}

.today-btn {
  padding: 8px 14px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #444;
  cursor: pointer;
  white-space: nowrap;
}

.today-btn:active {
  background: #e0e0e0;
}

/* ===== サマリーカード ===== */
.stat-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 24px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 44px;
  font-weight: 300;
  color: #0066cc;
  line-height: 1;
}

.stat-unit {
  font-size: 16px;
  color: #888;
  margin-left: 2px;
}

.stat-time {
  font-size: 24px;
  font-weight: 300;
  color: #1a1a1a;
  line-height: 1;
}

/* ===== テーブル ===== */
.table-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.table-section-title {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: bold;
  color: #888;
  border-bottom: 1px solid #eee;
  letter-spacing: 0.05em;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
}

.records-table th {
  background: #f8f8f8;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  color: #888;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}

.records-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
  vertical-align: top;
}

.records-table tr:last-child td {
  border-bottom: none;
}

.cat-suction { color: #0066cc; font-weight: bold; }
.cat-body_temp { color: #cc4400; }
.cat-water { color: #0099aa; }
.cat-memo { color: #664400; }
.cat-other { color: #666; }

.empty-msg {
  text-align: center;
  padding: 30px;
  color: #aaa;
  font-size: 15px;
}

.loading-msg {
  text-align: center;
  padding: 30px;
  color: #888;
  font-size: 15px;
}

.error-msg {
  text-align: center;
  padding: 20px;
  color: #cc0000;
  font-size: 15px;
}

/* ===== 週間テーブル ===== */
.week-table {
  width: 100%;
  border-collapse: collapse;
}

.week-table td {
  padding: 11px 18px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.week-table tr:last-child td {
  border-bottom: none;
}

.week-count {
  font-size: 22px;
  font-weight: bold;
  color: #0066cc;
  text-align: right;
}

.week-count-zero {
  font-size: 20px;
  color: #ccc;
  text-align: right;
}

.week-today {
  font-weight: bold;
  background: #f0f6ff;
}
