/* ============================================================
   デンジニア 共通スタイル
   スマホファースト必須（現場で使うため）。375px幅を基準にデザインし、
   PCでは単カラムを max-width: 480px で中央寄せするだけの割り切り
   （gd-design-guidelines踏襲: #EB6600・Noto Sans JP・角丸なし基調・整数px罫線。
   ログインカードのみ角丸12pxを許容する）。
   ============================================================ */

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

:root {
  --brand: #EB6600;
  --brand-hover: #b35a00;
  --brand-tint: #FBE0CC;
  --charcoal: #333333;
  --border: #D9D9D4;
  --error: #C0392B;
  --bg: #F4F4F1;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--charcoal);
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Roboto', 'Meiryo', sans-serif;
  /* iOSの入力時自動ズームを防ぐため、本文フォントも16px以上を基準にする */
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ホバー依存UI禁止（タッチのみで完結させる）。hoverが使える環境のみ薄いフィードバックを足す */
@media (hover: hover) {
  a:hover {
    opacity: 0.85;
  }
}

/* ============================================================
   ページ全体レイアウト（単カラム・375px基準・PCは480px中央寄せ）
   ============================================================ */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}

@media (min-width: 480px) {
  .page {
    padding: 0;
  }
}

.page-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 0 48px;
}

/* ============================================================
   固定ヘッダー（ロゴ + 氏名 + ログアウト。案件画面で使用）
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--brand);
  letter-spacing: 0.02em;
}

/* ============================================================
   ログインカード（角丸12pxを唯一許容する箇所）
   ============================================================ */
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 24px;
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo .app-logo {
  font-size: 24px;
}

.login-logo .app-logo-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #777;
  letter-spacing: 0.08em;
}

/* ============================================================
   フォーム部品（角丸なし・整数px罫線・タップ領域44px以上・16px以上フォント）
   ============================================================ */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.field input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
}

.field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #888;
}

.btn {
  display: block;
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

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

.btn-primary:active {
  background: var(--brand-hover);
}

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

.error-msg {
  color: var(--error);
  font-size: 13px;
  min-height: 18px;
  margin-top: 12px;
  text-align: center;
}

.banner {
  background: var(--brand-tint);
  border: 1px solid var(--brand);
  color: #7a3d00;
  font-size: 13px;
  padding: 12px;
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

/* ============================================================
   ヘッダー内 氏名・ログアウト（案件画面共通: index/list/job）
   ============================================================ */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-name {
  font-size: 13px;
  color: #555;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-logout {
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  cursor: pointer;
}

.header-logout:active {
  background: var(--bg);
}

/* ============================================================
   タップ可能バナー（未回答の依頼N件。index.htmlで使用）
   ============================================================ */
.banner-tap {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================================
   ホームへの導線リンク（list.html・job.html）
   ============================================================ */
.home-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--brand);
  text-decoration: none;
}

/* ============================================================
   ステータスタブ（list.html）
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  height: 44px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: #888;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ============================================================
   ステータスバッジ（requested=オレンジ・accepted=青系・
   completed/declined/canceled=グレー系）
   ============================================================ */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border: 1px solid;
  line-height: 1.4;
}

.badge-requested {
  background: var(--brand-tint);
  color: #7a3d00;
  border-color: var(--brand);
}

.badge-accepted {
  background: #DCEAFB;
  color: #1a4a7a;
  border-color: #2f6fb3;
}

.badge-completed {
  background: #E6E6E1;
  color: #555555;
  border-color: var(--border);
}

.badge-declined,
.badge-canceled {
  background: #F0F0EC;
  color: #888888;
  border-color: var(--border);
}

/* ============================================================
   案件カード（index.html・list.htmlで共用）
   ============================================================ */
.job-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}

.job-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.job-card-reward {
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
}

.job-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.job-card-tags {
  font-size: 13px;
  color: #666;
  margin-bottom: 2px;
}

.job-card-address {
  font-size: 13px;
  color: #888;
}

.empty-state {
  text-align: center;
  color: #888;
  font-size: 14px;
  padding: 24px 0;
}

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

/* ============================================================
   月カレンダー（自前実装。ライブラリ不使用。index.html）
   ============================================================ */
.calendar {
  background: #fff;
  border: 1px solid var(--border);
  padding: 12px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-nav-btn {
  width: 44px;
  height: 44px;
  font-size: 16px;
  font-weight: 700;
  background: none;
  border: none;
  color: var(--brand);
  cursor: pointer;
}

.cal-month-label {
  font-size: 15px;
  font-weight: 700;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--charcoal);
  cursor: pointer;
}

.cal-cell-empty {
  cursor: default;
}

.cal-cell-today {
  font-weight: 700;
  color: var(--brand);
}

.cal-cell-selected {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.cal-dots {
  display: flex;
  gap: 2px;
  height: 6px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.cal-dot-requested {
  background: var(--brand);
}

.cal-dot-accepted {
  background: #2f6fb3;
}

.cal-cell-selected .cal-dot-requested,
.cal-cell-selected .cal-dot-accepted {
  background: #fff;
}

/* ============================================================
   下部固定アクションバー（受ける/受けない・作業完了報告。job.html）
   親指で届く画面下部に大型ボタンを配置する（全体計画のスマホファースト要件）。
   ============================================================ */
body.has-bottom-bar .page-inner {
  padding-bottom: 96px;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.bottom-bar-inner {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.bottom-bar-inner .btn {
  flex: 1;
}

.btn-outline {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-outline:active {
  background: var(--brand-tint);
}

a.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ============================================================
   案件詳細（job.html）
   ============================================================ */
.detail-header {
  margin-bottom: 8px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.detail-rows {
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.detail-row-label {
  color: #888;
}

.detail-row-value {
  font-weight: 700;
  text-align: right;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #888;
  margin-bottom: 6px;
}

.detail-text {
  font-size: 14px;
  white-space: pre-wrap;
}

.address-link,
.tel-link {
  display: inline-block;
  font-size: 15px;
  color: var(--brand);
  text-decoration: underline;
}

/* ============================================================
   簡易モーダル（受けない理由・完了メモ。job.html）
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-panel {
  width: 100%;
  max-width: 400px;
  background: #fff;
  padding: 20px 16px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--border);
  resize: vertical;
  margin-bottom: 16px;
}

.modal-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

/* ============================================================
   アクションエラー（409等の遷移競合）＋再読み込み。job.html
   ============================================================ */
.action-error {
  background: #FBEAE7;
  border: 1px solid var(--error);
  color: var(--error);
  font-size: 13px;
  padding: 12px;
  margin-bottom: 16px;
}

.action-error-reload {
  display: inline-block;
  margin-top: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--error);
  border: none;
  cursor: pointer;
}
