:root {
  --bg: #f4f3ef;
  --card: #fff;
  --line: #e5e3dc;
  --line2: #d3d1c7;
  --text: #1f1f1d;
  --sub: #5f5e5a;
  --hint: #888780;
  --info-bg: #e6f1fb;
  --info-tx: #0c447c;
  --info-bd: #378add;
  --ok: #0f6e56;
  --ok-bg: #e1f5ee;
  --warn-bg: #faeeda;
  --warn-tx: #854f0b;
  --danger-bg: #fcebeb;
  --danger-tx: #a32d2d;
  --hotel: #1a3a4a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 16px;
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--card);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.header {
  background: var(--info-bg);
  padding: 16px;
  flex-shrink: 0;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--info-tx);
  margin-bottom: 2px;
}

.header-date {
  font-size: 13px;
  color: var(--info-tx);
  margin-bottom: 4px;
}


.header-count { text-align: right; flex-shrink: 0; }

.count-num {
  font-size: 24px;
  font-weight: 600;
  color: var(--info-tx);
}

.count-num small { font-size: 14px; }

.count-lbl {
  font-size: 11px;
  color: var(--info-tx);
}

.progress-bar-wrap {
  margin-top: 10px;
  height: 6px;
  background: rgba(255,255,255,0.6);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--info-tx);
  border-radius: 99px;
  transition: width 0.3s;
}

/* ---- Chohyo list ---- */
.chohyo-list {
  flex: 1;
  padding: 10px 12px 4px;
}

.section-label {
  font-size: 11px;
  color: var(--hint);
  margin: 8px 2px 8px;
  letter-spacing: 0.04em;
}

.chohyo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--info-bd);
  border-radius: 9px;
  margin-bottom: 7px;
  cursor: pointer;
  background: #fff;
  transition: transform 0.1s;
}

.chohyo-item:active { transform: scale(0.99); }

.chohyo-item.optional-item {
  border-color: var(--line);
  border-width: 0.5px;
}

.chohyo-item.item-done {
  border-color: var(--ok);
  border-width: 0.5px;
  background: #fafffe;
}

.icon-lead {
  font-size: 20px;
  color: var(--info-tx);
}

.item-done .icon-lead { color: var(--ok); }
.optional-item .icon-lead { color: var(--sub); }

.chohyo-name {
  flex: 1;
  font-size: 14px;
}

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-pending { background: var(--info-bg); color: var(--info-tx); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-alert { background: var(--danger-bg); color: var(--danger-tx); }
.badge-na { background: #f0efe9; color: var(--sub); border: 0.5px solid var(--line2); }
.badge-optional { background: #f0efe9; color: var(--sub); border: 0.5px solid var(--line2); }

/* ---- Footer ---- */
.footer {
  padding: 12px;
  border-top: 0.5px solid var(--line);
  flex-shrink: 0;
}

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 10px;
}

.alert-warn { background: var(--warn-bg); color: var(--warn-tx); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

/* ---- Buttons ---- */
.btn {
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  height: 48px;
  border-radius: 8px;
  border: 0.5px solid var(--line);
  cursor: pointer;
  background: #f0efe9;
  color: var(--hint);
}

.btn:disabled, .btn[disabled] {
  background: #f0efe9;
  color: var(--hint);
  cursor: not-allowed;
  opacity: 0.9;
}

.btn-confirm.btn-ready {
  background: var(--info-bg);
  color: var(--info-tx);
  border-color: var(--info-bd);
}

.btn-save {
  background: #f0efe9;
  color: var(--hint);
}

.btn-save.btn-ready {
  background: var(--info-bg);
  color: var(--info-tx);
  border-color: var(--info-bd);
}

.btn-sub {
  width: 100%;
  font-size: 13px;
  height: 40px;
  border-radius: 8px;
  border: 0.5px solid var(--line2);
  cursor: pointer;
  background: #fff;
  color: var(--sub);
}

/* ---- Draft button ---- */
.btn-draft {
  background: #fff;
  color: var(--info-tx);
  border: 0.5px solid var(--info-bd);
  margin-bottom: 8px;
}

/* ---- Restore modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-box {
  background: var(--card);
  border-radius: 12px;
  padding: 24px 20px 18px;
  width: min(320px, 90vw);
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ok);
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

.toast.show { opacity: 1; }

/* ---- Detail header ---- */
.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 0.5px solid var(--line);
  background: var(--card);
  flex-shrink: 0;
}

.back-btn {
  font-size: 22px;
  color: var(--sub);
  text-decoration: none;
  line-height: 1;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-nav {
  margin-bottom: 8px;
}

.btn-date-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--info-tx);
  text-decoration: none;
  border-radius: 8px;
  border: 0.5px solid var(--info-bd);
  background: rgba(255,255,255,0.5);
}

.detail-title h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.pattern-label {
  font-size: 11px;
  color: var(--hint);
}

/* ---- Detail body ---- */
.detail-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 6px;
}

.field-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field-row .field { flex: 1; min-width: 100px; }

.input-num {
  width: 100%;
  height: 44px;
  font-size: 16px;
  border: 0.5px solid var(--line2);
  border-radius: 8px;
  padding: 0 12px;
  text-align: right;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input-num:focus {
  border-color: var(--info-bd);
  box-shadow: 0 0 0 3px var(--info-bg);
}

/* ---- OX buttons ---- */
.ox-buttons {
  display: flex;
  gap: 8px;
}

.ox-buttons button {
  flex: 1;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: 0.5px solid var(--line2);
  background: #fff;
  color: var(--sub);
  cursor: pointer;
}

.ox-buttons button.sel-o { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.ox-buttons button.sel-x { background: var(--danger-bg); border-color: var(--danger-tx); color: var(--danger-tx); }
.ox-buttons button.sel-none { background: #f0efe9; border-color: var(--line2); color: var(--text); }

/* ---- Photo box ---- */
.photo-box {
  border: 1px dashed var(--line2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--sub);
  cursor: pointer;
  background: #faf9f6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.photo-box i { font-size: 24px; }

.photo-box.photo-has {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}

/* ---- Photo thumbnails ---- */
.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photo-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.photo-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line2);
}
.thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger-tx, #e53e3e);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

/* ---- Calc result ---- */
.calc-result {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 12px;
}

.calc-wait { background: #f0efe9; color: var(--hint); }
.calc-ok { background: var(--ok-bg); color: var(--ok); }
.calc-ng { background: var(--danger-bg); color: var(--danger-tx); }

/* ---- Hint text ---- */
.hint-text {
  font-size: 11px;
  color: var(--hint);
  margin-top: 4px;
}

/* ---- ALMEX items ---- */
.almex-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  margin-bottom: 7px;
  background: #fff;
}

.almex-item.almex-got {
  background: var(--ok-bg);
  border-color: var(--ok);
}

.almex-item.almex-got .almex-name { color: var(--ok); }

.almex-icon { font-size: 18px; color: var(--sub); }
.almex-got .almex-icon { color: var(--ok); }
.almex-name { flex: 1; font-size: 14px; }

.almex-shoot {
  font-size: 12px;
  color: var(--info-tx);
  cursor: pointer;
  border: 0.5px solid var(--info-bd);
  border-radius: 99px;
  padding: 3px 10px;
  background: var(--info-bg);
}

/* ---- Save bar ---- */
.save-bar {
  padding: 12px;
  border-top: 0.5px solid var(--line);
  flex-shrink: 0;
}

/* ---- Custom modal extras ---- */
.modal-msg { font-size: 1.1rem; margin-bottom: 8px; }
.modal-text-input {
  width: 100%; padding: 10px; font-size: 1.1rem;
  border: 1px solid #ccc; border-radius: 6px; margin: 12px 0; box-sizing: border-box;
}
.btn-modal-ok {
  background: #007aff; color: #fff; border: none; border-radius: 8px;
  padding: 12px 28px; font-size: 1rem; font-weight: bold; cursor: pointer; min-width: 80px;
}
.btn-modal-cancel {
  background: #f0f0f0; color: #555; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
}
