/* システムフォントを優先使用(ローカルfile:///環境でも確実に動作) */

:root {
  --blue: #1e7d4a;
  --blue-dark: #155834;
  --blue-light: #e6f5ec;
  --blue-mid: #b6dec7;
  --orange: #e05a1a;
  --orange-dark: #a03e0e;
  --green: #1e7d4a;
  --green-dark: #155834;
  --green-light: #e6f5ec;
  --green-mid: #b6dec7;
  --red: #c0392b;
  --yellow: #f39c12;
  --gray-bg: #f0f5f1;
  --border: #b6dec7;
  --text: #222;
  --radius: 14px;
  /* 各OSの標準日本語フォントを順に試す */
  --font-stack: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-stack);
  background: var(--gray-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px 60px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.offline-banner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--red);
  color: white;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.offline-banner.show { display: block; }

.app-header {
  background: white;
  border-bottom: 3px solid var(--blue);
  width: 100%;
  max-width: 640px;
  border-radius: 16px 16px 0 0;
  padding: 18px 24px 14px;
}
.header-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  position: relative;
}
.header-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
}
.header-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  position: relative;
}
.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.08em;
}
.header-title-icon {
  height: 32px;
  width: 32px;
  object-fit: contain;
}

.card {
  background: white;
  width: 100%;
  max-width: 640px;
  border-radius: 0 0 16px 16px;
  padding: 24px 22px 40px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.app-header + .card {
  border-radius: 0 0 16px 16px;
}

.card:first-child {
  border-radius: 16px;
}

.lbl {
  font-size: 19px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
  display: block;
}
.sub { font-size: 16px; color: #666; font-weight: 400; margin-left: 4px; }
.lbl-note { font-size: 14px; color: var(--red); font-weight: 700; margin-left: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  font-size: 20px;
  font-family: 'Noto Sans JP', sans-serif;
  padding: 14px 16px;
  border: 3px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #f8fbff;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 18px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); background: white; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%231e7d4a' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
}
textarea { min-height: 90px; resize: vertical; }
/* 配布終了の備考欄のみ、プレースホルダーが2段で収まるよう小さく */
#memo_配布終了 {
  font-size: 15px;
  padding: 10px 12px;
}
#memo_配布終了::placeholder {
  font-size: 13px;
  line-height: 1.4;
}

.login-help {
  background: var(--blue-light);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 20px;
}
.login-help strong {
  color: var(--blue);
  font-size: 17px;
}

.sec-title {
  font-size: 20px; font-weight: 700; color: var(--blue);
  border-left: 6px solid var(--blue);
  padding-left: 12px;
  margin: 24px 0 16px;
  line-height: 1.5;
}
.sec-title .sec-icon {
  font-size: 28px;
  vertical-align: middle;
  margin-right: 6px;
  display: inline-block;
}

.btn {
  width: 100%;
  font-size: 22px; font-weight: 900;
  font-family: 'Noto Sans JP', sans-serif;
  padding: 18px;
  border: none; border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
  letter-spacing: 0.05em;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-blue  { background: var(--blue);   color: white; box-shadow: 0 5px 0 var(--blue-dark); }
.btn-blue:disabled { background: #7aa993; box-shadow: 0 5px 0 #5a8775; }
.btn-green { background: #1e7d4a; color: white; box-shadow: 0 5px 0 #155834; }
.btn-green:disabled { background: #7aa993; box-shadow: 0 5px 0 #5a8775; cursor: not-allowed; }
.btn-orange{ background: var(--orange); color: white; box-shadow: 0 5px 0 var(--orange-dark); }
.btn-orange:disabled { background: #ccc; box-shadow: 0 5px 0 #aaa; cursor: not-allowed; }
.btn-gray  { background: #ddd; color: #555; box-shadow: 0 4px 0 #bbb; font-size: 18px; }
.btn-back  { background: none; border: 2px solid var(--blue); color: var(--blue); font-size: 16px; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-family: 'Noto Sans JP', sans-serif; cursor: pointer; margin-bottom: 18px; }
.btn-after-success { background: var(--blue) !important; color: white !important; }

.login-loading {
  display: none;
  text-align: center;
  padding: 20px;
  font-size: 17px;
  color: var(--blue);
  font-weight: 700;
}
.login-loading.show { display: block; }
.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 4px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.type-btn.feature-hidden { display: none; }
.type-btn {
  font-size: 19px; font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  padding: 22px 8px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: #f8fbff; color: #222;
  cursor: pointer; text-align: center;
  transition: all 0.15s; line-height: 1.4;
}
.type-btn .em { font-size: 32px; display: block; margin-bottom: 8px; }
.type-btn .type-btn-img {
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 6px;
  object-fit: contain;
}
.type-btn:hover { border-color: var(--blue); background: var(--blue-light); }
.type-btn:active { transform: scale(0.97); }
.type-btn.selected { border-color: var(--blue); background: var(--blue); color: white; box-shadow: 0 4px 0 var(--blue-dark); }
.type-btn.full { grid-column: span 2; }

.file-zone {
  display: block;
  border: 3px dashed var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 18px;
  position: relative;
  -webkit-tap-highlight-color: rgba(30, 125, 74, 0.15);
}
.file-zone:hover { border-color: var(--blue); background: var(--blue-light); }
.file-zone:active { border-color: var(--blue); background: var(--blue-light); }
.file-zone.has-file { border-color: var(--green); background: var(--green-light); }

.file-input-hidden {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.file-zone .fz-icon { font-size: 36px; display: block; margin-bottom: 8px; pointer-events: none; }
.file-zone .fz-text { font-size: 18px; font-weight: 700; color: #555; pointer-events: none; }
.file-zone .fz-sub  { font-size: 15px; color: #666; margin-top: 4px; pointer-events: none; }
.file-zone.has-file .fz-text { color: var(--green); }

.fz-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--red);
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.15s, color 0.15s;
}
.fz-clear:hover { background: var(--red); color: white; }
.fz-clear:active { transform: scale(0.9); }

.file-name-display { font-size: 16px; color: var(--green); font-weight: 700; margin-top: -12px; margin-bottom: 16px; word-break: break-all; }

/* 操作ヒントボックス */
.hint-box {
  background: #fff8ed;
  border: 2px solid #f3d8a8;
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
}
.hint-summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-dark);
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint-summary::-webkit-details-marker {
  display: none;
}
.hint-summary::before {
  content: '▶ ';
  display: inline-block;
  margin-right: 4px;
  transition: transform 0.2s;
  color: var(--orange);
}
details[open] .hint-summary::before {
  transform: rotate(90deg);
}
.hint-summary:hover { background: #fff2dd; }
.hint-content {
  padding: 8px 16px 16px;
  background: white;
  border-top: 1px solid #f3d8a8;
}
.hint-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0;
  font-size: 15px;
  line-height: 1.5;
  color: #333;
}
.hint-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--orange);
  color: white;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
  font-family: 'Noto Sans JP', sans-serif;
}
.hint-text {
  flex: 1;
  padding-top: 4px;
}
.hint-text strong {
  background: #fff2dd;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--orange-dark);
}
.hint-note {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--blue-light);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
}

/* AI注釈(GPX自動チェック注記) */
.ai-check-note {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-light);
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 6px;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 担当エリアのグリッド */
.area-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

/* 担当エリアの折りたたみボタン */
.area-toggle-btn {
  width: 100%;
  background: white;
  border: 2px dashed var(--blue);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  margin-bottom: 14px;
  transition: background 0.15s;
}
.area-toggle-btn:hover { background: var(--blue-light); }
.area-toggle-btn:active { transform: scale(0.99); }
.area-toggle-btn.expanded {
  background: var(--blue-light);
  border-style: solid;
}
.area-cell {
  position: relative;
  background: #f8fbff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 6px;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: 'Noto Sans JP', sans-serif;
}
.area-cell:hover { border-color: var(--blue); background: var(--blue-light); }
.area-cell.selected {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}
.area-cell .pin-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: white;
  border: 1.5px solid #ccc;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #999;
  transition: all 0.15s;
}
.area-cell.selected .pin-btn { background: white; border-color: #fff; }
.area-cell .pin-btn.pinned {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}
.area-cell .pin-btn:hover { transform: scale(1.15); }
.area-selected {
  background: var(--blue-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  color: #333;
  margin-bottom: 14px;
}
.area-selected strong { color: var(--blue); font-weight: 900; }

/* ピン止めエリア */
.pinned-areas-wrap {
  background: var(--green-light);
  border: 2px solid var(--green-mid, #b6dec7);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.pinned-areas-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.pinned-areas-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pinned-area-chip {
  background: white;
  border: 2px solid var(--green);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s;
}
.pinned-area-chip:hover { background: var(--green); color: white; }
.pinned-area-chip.selected { background: var(--green); color: white; }

/* ピン止めチップ + ×ボタンのラッパー */
.pinned-area-chip-wrap {
  position: relative;
  display: inline-block;
}
.pinned-area-chip-wrap .pinned-area-chip {
  padding-right: 24px;
}
.pinned-area-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #c0392b;
  border: 2px solid white;
  color: white;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.1s, background 0.15s;
  z-index: 5;
}
.pinned-area-remove:hover { background: #a52e22; transform: scale(1.1); }
.pinned-area-remove:active { transform: scale(0.9); }

/* 町レコメンド */
.town-recommend {
  background: #f3f9f5;
  border: 2px solid #b6dec7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: -10px;
  margin-bottom: 16px;
}
.town-rec-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.town-rec-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.town-rec-chip {
  background: white;
  border: 2px solid var(--green);
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}
.town-rec-chip:hover, .town-rec-chip:active { background: var(--green); color: white; }

/* 配布形態 */
.dist-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.dist-type-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fbff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 6px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-align: center;
}
.dist-type-item.full { grid-column: span 2; }
.dist-type-item:has(.dist-type-chk:checked) {
  border-color: var(--green);
  background: var(--green-light);
}
.dist-type-chk {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--green);
}
.dist-type-em {
  font-size: 28px;
  margin-bottom: 4px;
}
.dist-type-name {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  line-height: 1.3;
}
.dist-type-item:has(.dist-type-chk:checked) .dist-type-name {
  color: var(--green-dark);
}

.cal-container { margin-bottom: 18px; }
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: white; border-radius: 10px 10px 0 0;
  padding: 12px 16px; font-size: 18px; font-weight: 700;
}
.cal-nav { background: none; border: none; color: white; font-size: 22px; cursor: pointer; padding: 4px 10px; }
.cal-grid { border: 2px solid var(--blue-mid); border-top: none; border-radius: 0 0 10px 10px; overflow: hidden; }
.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); background: var(--blue-light); }
.cal-dow span { text-align: center; padding: 8px 0; font-size: 14px; font-weight: 700; color: var(--blue); }
.cal-dow span:first-child { color: #e74c3c; }
.cal-dow span:last-child  { color: #2980b9; }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-day {
  border: 1px solid #e8eef5;
  padding: 10px 4px; text-align: center;
  font-size: 17px; font-weight: 700; cursor: pointer;
  transition: background 0.1s; min-height: 46px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); background: white;
}
.cal-day:hover:not(.empty):not(.disabled) { background: var(--blue-light); }
.cal-day.empty { background: #fafafa; cursor: default; }
.cal-day.disabled { color: #ccc; cursor: not-allowed; background: #fafafa; }
.cal-day.in-range { background: #d0e4f7; }
.cal-day.range-start, .cal-day.range-end { background: var(--blue); color: white; border-radius: 6px; }
.cal-day.today { outline: 3px solid var(--orange); outline-offset: -3px; }
.cal-day:nth-child(7n+1) { color: #e74c3c; }
.cal-day:nth-child(7n+1).range-start, .cal-day:nth-child(7n+1).range-end { color: white; }
.cal-day:nth-child(7n)   { color: #2980b9; }
.cal-day:nth-child(7n).range-start, .cal-day:nth-child(7n).range-end { color: white; }
.cal-day.disabled { color: #ccc !important; }

.range-display {
  background: var(--blue-light); border-radius: 10px;
  padding: 12px 16px; font-size: 17px; font-weight: 700; color: var(--blue);
  margin-bottom: 16px; text-align: center; min-height: 48px; line-height: 1.5;
}

.early-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  align-items: center; justify-content: center; padding: 20px;
}
.early-modal-overlay.show { display: flex; }
.early-modal {
  background: white; border-radius: 16px;
  padding: 32px 24px 24px;
  max-width: 360px; width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  text-align: center;
}
.early-modal-icon { font-size: 48px; margin-bottom: 12px; }
.early-modal-msg {
  font-size: 19px; font-weight: 700; color: #c0392b;
  margin-bottom: 24px; line-height: 1.5;
}
.early-modal-cancel {
  width: 100%; font-size: 18px; padding: 15px;
}

.rest-required-note {
  display: block;
  font-size: 14px; font-weight: 700;
  color: #c0392b; margin-top: 4px;
}

.loggedin-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue-light); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  gap: 8px;
}
.loggedin-staff {
  font-size: 16px; font-weight: 700; color: var(--blue);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.loggedin-id {
  font-size: 13px; font-weight: 700; color: #555;
  background: white; border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.loggedin-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.loggedin-sep { color: #bbb; font-size: 15px; flex-shrink: 0; }

.form-type-label {
  font-size: 14px;
  background: var(--blue);
  color: white;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.gear-btn2 {
  background: none; border: none;
  cursor: pointer; padding: 4px 6px; line-height: 1;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gear-btn2:hover { opacity: 0.6; }
.gear-btn2:active { transform: scale(0.9); }
.gear-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.gear-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 50;
  min-width: 160px;
}
.gear-menu.show { display: block; }
.gear-menu-item {
  width: 100%;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  text-align: left;
}
.gear-menu-item:hover { background: #fee; }

.err { color: var(--red); font-size: 16px; font-weight: 700; margin-top: -12px; margin-bottom: 12px; display: none; line-height: 1.5; }
.err.show { display: block; }

.success-box {
  display: none; background: var(--green-light); border: 3px solid var(--green);
  border-radius: 12px; padding: 22px; text-align: center;
  font-size: 20px; font-weight: 700; color: #1a7a42; margin-top: 20px;
  line-height: 1.6;
}
.success-box .big { font-size: 44px; display: block; margin-bottom: 8px; }

.success-details {
  margin-top: 14px;
  padding: 12px 14px;
  background: white;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  line-height: 1.7;
}
.success-detail-row {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}
.success-detail-row:last-child {
  border-bottom: none;
}
.success-detail-label {
  font-weight: 700;
  color: #555;
  min-width: 88px;
  flex-shrink: 0;
}

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 200;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 16px; padding: 26px 22px;
  max-width: 500px; width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3); max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 21px; font-weight: 900; color: var(--blue); margin-bottom: 16px; text-align: center; }
.modal-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #eee; font-size: 16px; }
.modal-row .ml { color: #666; white-space: nowrap; margin-right: 12px; }
.modal-row .mv { font-weight: 700; color: var(--text); text-align: right; word-break: break-all; }
.modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.modal-btns .btn { font-size: 18px; padding: 15px; }

.sending-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 400;
  align-items: center; justify-content: center; padding: 20px;
}
.sending-overlay.show { display: flex; }
.sending-box {
  background: white; border-radius: 16px;
  padding: 40px 30px;
  text-align: center;
  max-width: 320px; width: 100%;
}
.spinner-large {
  display: inline-block;
  width: 64px;
  height: 64px;
  border: 6px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}
.sending-msg {
  font-size: 22px;
  font-weight: 900;
  color: var(--blue);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}
.sending-sub {
  font-size: 16px;
  color: #666;
  font-weight: 700;
}

.screen { display: none; }
.screen.active { display: block; }

.file-error {
  display: none;
  background: #fde8e8;
  border: 2px solid var(--red);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 16px;
  text-align: center;
}
.file-error.show { display: block; }

.time-stamp-box {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 18px;
}
.ts-time {
  font-size: 52px; font-weight: 900; color: var(--blue);
  letter-spacing: 0.08em; margin-bottom: 14px;
}
.ts-time.stamped { color: var(--green); }
.btn-stamp {
  width: 100%; font-size: 22px; font-weight: 900;
  font-family: 'Noto Sans JP', sans-serif;
  padding: 20px; background: var(--blue); color: white;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 5px 0 var(--blue-dark);
  transition: transform 0.1s; letter-spacing: 0.05em;
}
.btn-stamp:active { transform: scale(0.97); }
.btn-stamp.stamped { background: var(--green); box-shadow: 0 5px 0 #1a7a42; }
.ts-note { margin-top: 12px; font-size: 16px; color: var(--green); font-weight: 700; }
.btn-restamp {
  margin-top: 10px; font-size: 16px;
  font-family: 'Noto Sans JP', sans-serif;
  background: none; border: 2px solid #888; border-radius: 8px;
  color: #666; padding: 8px 16px; cursor: pointer; font-weight: 700;
}

.kariya-num-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 12px;
  background: #f8fbff;
  border-bottom: 1px solid #e0eaf5;
}
.kariya-num-label {
  font-size: 16px; color: #555; font-weight: 700;
}
.kariya-num-input {
  width: 120px; font-size: 20px; font-family: 'Noto Sans JP', sans-serif;
  padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px;
  text-align: right; background: white; color: var(--text);
  margin-bottom: 0 !important;
  -moz-appearance: textfield;
  appearance: textfield;
}
.kariya-num-input::-webkit-outer-spin-button,
.kariya-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.kariya-num-input:focus { border-color: var(--blue); outline: none; }

.done-info-box {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.6;
}
.done-info-box .done-info-sub {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: #555;
  margin-top: 6px;
}

.btn-history {
  width: 100%;
  font-size: 16px;
  font-family: 'Noto Sans JP', sans-serif;
  padding: 14px;
  background: white;
  border: 2px solid var(--blue);
  border-radius: 12px;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
  margin-top: 16px;
  transition: background 0.15s;
}
.btn-history:hover { background: var(--blue-light); }
.btn-history:active { transform: scale(0.98); }

.history-info {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.6;
  text-align: center;
}
.history-info-sub {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #555;
  margin-top: 4px;
}

.history-note {
  background: #fff8e6;
  border: 1px solid #f3d8a8;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #8a5b00;
  line-height: 1.5;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 16px;
}

.history-item {
  background: #f8fbff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.history-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.history-type-badge {
  background: var(--blue);
  color: white;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}
.history-time {
  font-size: 14px;
  color: #666;
  font-weight: 700;
}
.history-summary {
  font-size: 15px;
  color: #333;
  line-height: 1.5;
  margin-top: 4px;
  word-break: break-all;
}

/* ============================================================
   マニュアル画面
   ============================================================ */
.manual-info {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.6;
  text-align: center;
}
.manual-info-sub {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #555;
  margin-top: 4px;
}

.manual-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manual-item {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.manual-item[open] {
  border-color: var(--blue);
}

.manual-summary {
  cursor: pointer;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
  position: relative;
}
.manual-summary::-webkit-details-marker {
  display: none;
}
.manual-summary::after {
  content: '▼';
  margin-left: auto;
  color: var(--blue);
  font-size: 14px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.manual-item[open] .manual-summary::after {
  transform: rotate(180deg);
}
.manual-summary:hover {
  background: var(--blue-light);
}
.manual-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.manual-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.manual-content {
  padding: 16px 18px;
  background: #fafafa;
  border-top: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.7;
  color: #333;
}

.manual-desc {
  font-size: 15px;
  color: #444;
  margin-bottom: 14px;
  line-height: 1.6;
}

.manual-pdf-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 3px 0 var(--blue-dark);
  transition: transform 0.1s, box-shadow 0.1s;
}
.manual-pdf-btn:hover {
  background: var(--blue-dark);
}
.manual-pdf-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--blue-dark);
}

.manual-placeholder {
  text-align: center;
  padding: 30px 16px;
  color: var(--blue);
  font-size: 16px;
  font-weight: 700;
  background: white;
  border: 2px dashed var(--blue-mid);
  border-radius: 10px;
}
.placeholder-sub {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #888;
  margin-top: 8px;
}

/* ==========================================
   マニュアル サブメニュー(ネスト構造)
   ========================================== */
.manual-sublist {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.manual-subitem {
  background: white;
  border: 2px solid var(--blue-mid);
  border-radius: 10px;
  overflow: hidden;
}
.manual-subitem[open] {
  border-color: var(--blue);
}
.manual-subsummary {
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  background: var(--blue-light);
  list-style: none;
  position: relative;
  padding-right: 36px;
  line-height: 1.5;
}
.manual-subsummary::-webkit-details-marker {
  display: none;
}
.manual-subsummary::after {
  content: '▼';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--blue);
  font-size: 12px;
  transition: transform 0.2s;
}
.manual-subitem[open] .manual-subsummary::after {
  transform: translateY(-50%) rotate(180deg);
}
.manual-subcontent {
  padding: 14px 16px;
  background: #fafafa;
  border-top: 1px solid var(--blue-mid);
}
.manual-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  background: white;
  border: 2px dashed var(--blue-mid);
  border-radius: 10px;
}

.kariya-title {
  font-size: 20px; font-weight: 900; color: var(--blue);
  text-align: center; padding: 14px 0 8px;
  letter-spacing: 0.04em;
}
.kariya-area {
  text-align: center; margin-bottom: 16px;
  background: var(--blue-light); border-radius: 8px;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.kariya-area-label {
  font-size: 16px;
  font-weight: 700;
  color: #555;
}
.kariya-area-name {
  font-size: 24px;
  font-weight: 900;
  color: var(--blue);
  letter-spacing: 0.05em;
  background: white;
  padding: 4px 16px;
  border-radius: 8px;
  border: 2px solid var(--blue);
}
.kariya-check-list {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}
.kariya-check-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #e8eef5;
  background: white;
}
.kariya-check-row:last-child { border-bottom: none; }
.kariya-check-row:nth-child(even) { background: #fafcff; }
.kariya-item-name {
  font-size: 20px; font-weight: 700; color: var(--text);
}
.kariya-check-label {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.kariya-chk {
  width: 28px; height: 28px;
  accent-color: var(--blue); cursor: pointer; flex-shrink: 0;
}
.kariya-chk-text {
  font-size: 18px; font-weight: 700; color: #666; white-space: nowrap;
}
.kariya-chk:checked + .kariya-chk-text { color: var(--blue); }

.dial-box {
  display: flex; flex-direction: column; align-items: center;
  background: var(--blue-light); border-radius: 16px;
  padding: 16px 20px; margin-bottom: 18px; gap: 10px;
}
.dial-nav {
  width: 100%; max-width: 320px; font-size: 22px;
  background: white; border: 2px solid var(--blue-mid);
  border-radius: 12px; color: var(--blue);
  padding: 10px 0; cursor: pointer; font-weight: 900;
  transition: background 0.12s, color 0.12s; user-select: none;
}
.dial-nav:hover { background: var(--blue); color: white; }
.dial-nav:active { transform: scale(0.97); }
.dial-display {
  width: 100%; max-width: 320px; text-align: center;
  font-size: 30px; font-weight: 900; color: var(--blue);
  background: white; border-radius: 12px; padding: 14px 8px;
  letter-spacing: 0.05em; border: 3px solid var(--blue-mid);
  transition: color 0.2s, border-color 0.2s;
}
.dial-display.night-time { color: #5b4a8a; border-color: #c5b5e8; }
.dial-display.unset { color: #888; font-size: 18px; font-weight: 400; border-color: #ddd; }

@media (max-width: 400px) {
  body { padding: 12px 8px 40px; }
  .card { padding: 20px 16px 32px; }
  .app-header { padding: 14px 16px 12px; }
  .loggedin-staff { font-size: 16px; }
  .type-btn { font-size: 18px; padding: 20px 6px; }
  .type-btn .em { font-size: 30px; }
  .sec-title { font-size: 19px; }
}

.kariya-item-name-input.compact {
  width: 48%;
  min-width: 145px;
  height: 44px;
  border: 2px solid var(--green-mid);
  box-shadow: none;
  background: #fff;
  padding: 6px 8px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  color: #222;
  box-sizing: border-box;
}

.kariya-item-name-input.compact::placeholder {
  color: #d6d6d6;
  opacity: 1;
  font-weight: 500;
}

.kariya-item-name-input.compact:focus {
  outline: none;
  border-color: var(--green);
  background: #f8fffb;
}