:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-bg: #f1f5f9;
  --color-card: #ffffff;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-error: #dc2626;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

/* display:flex 等を持つ要素でも hidden 属性が確実に効くようにする */
[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  background: #1e293b;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  z-index: 1000;
  text-align: center;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

#app {
  width: 100%;
  max-width: 480px;
  margin-top: 6vh;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  padding: 32px 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.card-wide {
  max-width: 100%;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  text-transform: uppercase;
}

.title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--color-muted);
  line-height: 1.6;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

input[type="tel"],
input[type="text"],
input[type="email"],
input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 8px;
}

input[type="tel"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

input.input-otp {
  width: 100%;
  padding: 12px 14px;
  font-size: 22px;
  letter-spacing: 0.4em;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 8px;
}

input.input-otp:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

.error-message {
  min-height: 20px;
  font-size: 13px;
  color: var(--color-error);
  margin: 0 0 12px;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-text {
  background: transparent;
  color: var(--color-muted);
  font-weight: 600;
  font-size: 13px;
  margin-top: 4px;
}

.btn-text:hover {
  color: var(--color-text);
}

.btn-danger {
  background: #fff;
  color: var(--color-error);
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
}

.readonly-value {
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--color-muted);
}

select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 8px;
  font-family: inherit;
  color: var(--color-text);
}

select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

.hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
}

#share-result {
  white-space: pre-wrap;
  word-break: break-all;
}

a.btn {
  text-decoration: none;
  text-align: center;
}

.info-list {
  margin: 0 0 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.info-row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row dt {
  flex: 0 0 88px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
}

.info-row dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.map-preview {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.map-preview iframe {
  display: block;
  width: 100%;
  height: 180px;
  border: none;
}

.notice-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.notice-list li {
  border-bottom: 1px solid var(--color-border);
}

.notice-list li:last-child {
  border-bottom: none;
}

.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.6;
}

.notice-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--color-primary);
}

.section-heading {
  font-size: 15px;
  font-weight: 700;
  margin: 24px 0 12px;
}

.report-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 6px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.report-item:hover {
  border-color: var(--color-primary);
}

.report-item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.report-item:disabled:hover {
  border-color: var(--color-border);
}

.report-item-main {
  flex: 1 1 auto;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-item-label {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.report-item-meta {
  font-size: 12px;
  color: var(--color-muted);
}

.report-item-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
}

.report-item-status.done {
  background: #dcfce7;
  color: #15803d;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 20px;
}

.btn-pagination {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 10px 16px;
  font-size: 13px;
}

.btn-pagination:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-status {
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
}

.field-group {
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  resize: vertical;
  margin-bottom: 8px;
}

textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

.photo-grid {
  margin-bottom: 12px;
}

.photo-grid:empty {
  margin-bottom: 0;
}

.photo-thumb {
  position: relative;
  width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.photo-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-photo-add {
  flex: 1;
  min-width: 0;
  display: block;
  text-align: center;
  background: #fff;
  border: 1px dashed #94a3b8;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 12px;
  padding: 14px 6px;
  margin-top: 0;
  cursor: pointer;
}

.board-partner {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
}

.board-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 45vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 4px 8px;
  margin-bottom: 12px;
}

.board-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  min-width: 0;
}

/* .msg-mine = 自分の発言（右寄せ・青）, .msg-theirs = 相手の発言（左寄せ・グレー）
   「自分」が誰か（職人視点なら職人、営業担当視点なら営業担当）はレンダリング時に決める。 */
.board-message.msg-theirs {
  align-items: flex-start;
  align-self: flex-start;
}

.board-message.msg-mine {
  align-items: flex-end;
  align-self: flex-end;
}

.board-message-meta {
  font-size: 11px;
  color: var(--color-muted);
  margin-bottom: 4px;
  padding: 0 4px;
}

.board-message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.board-message.msg-theirs .board-message-bubble {
  background: #f1f5f9;
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.board-message.msg-mine .board-message-bubble {
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.board-message-empty {
  text-align: center;
  font-size: 13px;
  color: var(--color-muted);
  padding: 24px 0;
}

.activity-report-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.activity-report-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.activity-report-label {
  font-size: 14px;
  font-weight: 700;
}

.activity-report-time {
  font-size: 12px;
  color: var(--color-muted);
}

.activity-report-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.activity-report-photos img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

.activity-report-note {
  font-size: 13px;
  color: var(--color-text);
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
}

.activity-report-empty {
  font-size: 13px;
  color: var(--color-muted);
}

#board-form,
.board-form {
  display: flex;
  flex-direction: column;
}

#board-form textarea,
.board-form textarea {
  resize: none;
}
