/* =====================================================
   運転日報システム - スタイルシート
   ===================================================== */

:root {
  --primary:       #1a56db;
  --primary-dark:  #1646b8;
  --primary-light: #e8f0fe;
  --success:       #0e9f6e;
  --warning:       #d97706;
  --danger:        #e02424;
  --danger-light:  #fef2f2;
  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-300:      #d1d5db;
  --gray-400:      #9ca3af;
  --gray-500:      #6b7280;
  --gray-600:      #4b5563;
  --gray-700:      #374151;
  --gray-800:      #1f2937;
  --gray-900:      #111827;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 2px 8px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.1);
  --radius:        8px;
  --radius-lg:     12px;
  --font:          'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

/* ======================== HEADER ======================== */
/* 初期は非表示。ログイン後に JS で display:block にする */
.site-header {
  display: none;
  background: #fff;
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.header-logo i {
  font-size: 22px;
}
.header-actions {
  display: flex;
  gap: 8px;
}

/* ======================== MAIN ======================== */
/* 初期は非表示。ログイン後に JS で display:block にする */
.main-content {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c81a1a; }
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #0a7a55; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; font-weight: 700; }

/* ======================== SECTION LAYOUT ======================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header h2 i { color: var(--primary); }

/* 一覧ヘッダー右側まとめ */
.section-header-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.csv-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.csv-filter-row input[type="date"] {
  padding: 6px 10px;
  font-size: 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font);
  color: var(--gray-700);
  outline: none;
  width: 140px;
}
.csv-filter-row input[type="date"]:focus { border-color: var(--primary); }
.filter-sep {
  font-size: 13px;
  color: var(--gray-400);
  padding: 0 2px;
}

.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.search-bar input:focus { border-color: var(--primary); }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 13px;
}

/* ======================== FORM TOOLBAR ======================== */
.form-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.form-toolbar h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-toolbar h2 i { color: var(--primary); }

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-actions { display: flex; gap: 8px; }

/* ======================== FORM SECTIONS ======================== */
.form-section {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subsection-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid var(--gray-300);
  padding-left: 8px;
}

/* Grid */
.form-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.form-grid.col-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.col-3 { grid-template-columns: repeat(3, 1fr); }

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-group.required label::after {
  content: '必須';
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 600;
}

/* Inputs */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  color: var(--gray-800);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .08);
}
input:readonly, input[readonly] {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 36, 36, .08);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.auto-calc {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}

/* Radio buttons */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
  user-select: none;
}
.radio-label input[type="radio"] { display: none; }
.radio-custom {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gray-400);
  background: #fff;
  transition: all .15s;
  flex-shrink: 0;
  position: relative;
}
.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px #fff;
}
.radio-label input[type="radio"]:checked + .radio-custom.radio-danger {
  border-color: var(--danger);
  background: var(--danger);
}
.radio-label input[type="radio"]:checked + .radio-custom.radio-warn {
  border-color: var(--warning);
  background: var(--warning);
}

/* Route rows */
.route-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.route-input { flex: 1; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 2px;
  line-height: 1;
  transition: transform .15s, color .15s;
}
.btn-icon-add { color: var(--primary); }
.btn-icon-add:hover { transform: scale(1.2); }
.btn-icon-remove { color: var(--danger); }
.btn-icon-remove:hover { transform: scale(1.2); }

/* Info box */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 0;
}
.info-box i { flex-shrink: 0; margin-top: 2px; }
.info-box-blue {
  background: #eff6ff;
  border-left: 3px solid var(--primary);
  color: var(--primary-dark);
}

/* Form actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
  margin-top: 4px;
}

/* ======================== REPORT LIST ======================== */
.report-list {
  display: grid;
  gap: 12px;
}
.loading-spinner {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
  font-size: 16px;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

.report-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.report-card-main { display: flex; flex-direction: column; gap: 4px; }
.report-card-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
}
.report-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-card-meta {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2px;
}
.report-card-meta span { display: flex; align-items: center; gap: 4px; }
.report-card-actions { display: flex; gap: 6px; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-green { background: #ecfdf5; color: var(--success); }

/* Pagination */
.pagination-area {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.pagination-area button {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-300);
  background: #fff;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.pagination-area button:hover { border-color: var(--primary); color: var(--primary); }
.pagination-area button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-area button:disabled { opacity: .4; cursor: not-allowed; }

/* ======================== DETAIL VIEW ======================== */
.report-detail-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.detail-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-100);
}
.detail-section:last-child { border-bottom: none; margin-bottom: 0; }
.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
}
.detail-item {}
.detail-item-label {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 2px;
}
.detail-item-value {
  font-size: 14px;
  color: var(--gray-800);
  font-weight: 500;
}
.detail-item-value.highlight {
  color: var(--primary);
  font-weight: 700;
}
.detail-item-value.danger { color: var(--danger); font-weight: 700; }

/* ======================== TOAST ======================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--gray-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  animation: slideIn .3s ease;
  max-width: 320px;
  pointer-events: auto;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger); }
.toast.toast-warn    { background: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* ======================== MODAL ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.modal-icon {
  font-size: 36px;
  color: var(--danger);
  margin-bottom: 12px;
}
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-box p  { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ======================== ACCIDENT ALERT BANNER ======================== */
.accident-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 3px 12px rgba(224,36,36,.4);
  animation: bannerSlideDown .35s ease;
}
@keyframes bannerSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.accident-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.accident-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
  animation: alertPulse .8s ease infinite alternate;
}
.accident-banner-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.accident-banner-text strong { font-size: 14px; }
.accident-banner-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.accident-banner-close:hover { background: rgba(255,255,255,.35); }
/* バナー表示時にヘッダーを下にずらす */
body.has-banner .site-header { top: 48px; }

/* ======================== CARGO ENTRIES ======================== */
.cargo-count-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 99px;
  padding: 2px 10px;
  border: 1px solid #c3d8f8;
}
.cargo-entry {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow .2s;
}
.cargo-entry:focus-within { box-shadow: 0 0 0 3px rgba(26,86,219,.1); border-color: var(--primary); }
.cargo-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  user-select: none;
  transition: background .15s;
}
.cargo-entry-header:hover { background: var(--gray-100); }
.cargo-entry-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cargo-entry-summary {
  flex: 1;
  font-size: 12px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cargo-entry-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cargo-chevron {
  color: var(--gray-400);
  font-size: 13px;
  transition: transform .2s;
}
.cargo-entry-body {
  padding: 16px;
  border-top: none;
}
.btn-add-cargo {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  color: var(--primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  justify-content: center;
  transition: background .15s, border-color .15s;
  margin-top: 4px;
}
.btn-add-cargo:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-add-cargo i { font-size: 16px; }

/* ======================== ACCIDENT ALERT MODAL ======================== */
.accident-alert-box {
  max-width: 440px;
  border-top: 5px solid var(--danger);
  padding: 32px 28px 24px;
}
.alert-modal-icon {
  font-size: 48px;
  color: var(--danger);
  margin-bottom: 10px;
  animation: alertPulse 1s ease infinite alternate;
}
@keyframes alertPulse {
  from { opacity: 1;   transform: scale(1); }
  to   { opacity: .7; transform: scale(1.12); }
}
.alert-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 10px;
}
.alert-modal-report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 14px;
}
.alert-modal-desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 20px;
}
.alert-modal-desc strong { color: var(--gray-800); }
.alert-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.btn-alert {
  background: var(--danger);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .2s, transform .15s;
}
.btn-alert:hover { background: #c81a1a; transform: translateY(-1px); }
.alert-modal-note {
  font-size: 11px;
  color: var(--gray-400);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.5;
  text-align: left;
}
.alert-modal-note i { margin-top: 2px; flex-shrink: 0; }

/* ======================== INSPECTION CHECKLIST ======================== */
.inspection-summary {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 99px;
  padding: 2px 10px;
}
.inspection-summary.warn {
  color: var(--warning);
  background: #fffbeb;
  border-color: #fde68a;
}

.inspection-category {
  margin-bottom: 18px;
}
.inspection-category-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.inspection-category-title i {
  color: var(--primary);
  width: 14px;
  text-align: center;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 12px;
}

/* チェックボックスアイテム */
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  background: #fff;
  transition: background .15s, border-color .15s;
  user-select: none;
}
.check-item:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}
.check-item input[type="checkbox"] {
  display: none;
}
.check-custom {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--gray-300);
  background: #fff;
  position: relative;
  transition: all .15s;
}
.check-custom::after {
  content: '';
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.check-item input[type="checkbox"]:checked + .check-custom {
  background: var(--success);
  border-color: var(--success);
}
.check-item input[type="checkbox"]:checked + .check-custom::after {
  display: block;
}
.check-item input[type="checkbox"]:checked ~ .check-text {
  color: var(--success);
  font-weight: 500;
}
.check-text {
  font-size: 12.5px;
  color: var(--gray-700);
  line-height: 1.4;
  transition: color .15s;
}

/* 一括操作ボタン */
.inspection-bulk-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--gray-200);
}

/* 詳細ビュー用チェックリスト */
.detail-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.detail-check-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}
.detail-check-badge i { font-size: 10px; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 768px) {
  .main-content { padding: 16px 12px 60px; }
  .header-inner { padding: 10px 12px; }
  .header-logo span { font-size: 15px; }

  .form-grid.col-2,
  .form-grid.col-3 { grid-template-columns: 1fr; }

  .form-section { padding: 16px; }
  .form-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .form-toolbar h2 { font-size: 15px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .report-card { grid-template-columns: 1fr; }
  .report-card-actions { justify-content: flex-end; }

  .report-detail-card { padding: 16px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }

  .section-header { flex-direction: column; align-items: flex-start; }
  .section-header-right { width: 100%; align-items: flex-start; }
  .search-bar { max-width: 100%; width: 100%; }

  .header-actions .btn span { display: none; }
}

@media (max-width: 400px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ======================== DISPATCH TABS ======================== */
.dispatch-tab-header {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dispatch-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: color .2s, border-color .2s;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
}
.dispatch-tab-btn:hover { color: var(--primary); background: var(--gray-50); }
.dispatch-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }

/* テンプレートカード */
.tmpl-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  transition: box-shadow .15s;
}
.tmpl-card:hover { box-shadow: 0 2px 8px rgba(26,86,219,.10); border-color: var(--primary-light, #93c5fd); }
.tmpl-card-title { font-weight: 700; font-size: 15px; color: var(--gray-800); margin-bottom: 6px; }
.tmpl-card-meta { font-size: 12px; color: var(--gray-500); display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tmpl-card-meta span { display: flex; align-items: center; gap: 4px; }
.tmpl-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* コピーモーダル 複数日ピッカー */
.copy-date-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; padding: 4px 0; }
.copy-date-row { display: flex; align-items: center; gap: 8px; }
.copy-date-row input[type="date"] { flex: 1; }

/* ======================== PRINT AREA (screen hidden) ======================== */
#printArea { display: none; }

/* ======================== PRINT STYLES ======================== */
@media print {
  /* 画面要素を非表示 */
  body > *:not(#printArea) { display: none !important; }
  .site-header,
  .main-content,
  .toast-container,
  .modal-overlay { display: none !important; }
  #printArea > :not(.print-root) { display: none !important; }

  /* ページ設定 — A4縦 余白10mm均等 */
  @page {
    size: A4 portrait;
    margin: 10mm 10mm 10mm 10mm;
  }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-sizing: border-box; }

  /* 印刷エリア：ページ全体に広げる */
  #printArea {
    display: block !important;
    position: static !important;
    width: 100% !important;
    background: #fff;
    padding: 0;
    margin: 0;
  }

  /* 印刷ルート — A4可用幅 190mm をフル使用 */
  .print-root {
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
    font-size: 8.5pt;
    color: #000;
    line-height: 1.4;
    width: 190mm;
    max-width: 190mm;
    margin: 0 auto;
    overflow: hidden;
  }

  /* タイトルバー */
  .print-title-bar {
    display: flex;
    align-items: center;
    border-bottom: 2pt solid #1a56db;
    padding-bottom: 5pt;
    margin-bottom: 6pt;
    gap: 8pt;
  }
  .print-company   { flex: 1; font-size: 8pt; color: #555; }
  .print-main-title {
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: 4pt;
    color: #1a56db;
    text-align: center;
    flex: 2;
  }
  .print-date-box {
    flex: 1;
    text-align: right;
    font-size: 9pt;
    font-weight: 600;
  }
  .pdb-label { color: #555; margin-right: 3pt; }
  .pdb-value { font-weight: 700; }

  /* セクション見出し */
  .pt-section-title {
    background: #1a56db;
    color: #fff;
    font-size: 8pt;
    font-weight: 700;
    padding: 2pt 6pt;
    margin: 5pt 0 1pt;
    letter-spacing: 0.5pt;
  }

  /* テーブル共通 — 幅100%厳守・折り返し許可 */
  .pt {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-bottom: 2pt;
    font-size: 8pt;
    word-break: break-all;
  }
  .pt th, .pt td {
    border: 0.5pt solid #999;
    padding: 3pt 4pt;
    vertical-align: middle;
    word-break: break-all;
    overflow-wrap: break-word;
  }
  .pt th {
    background: #eef3fb;
    font-weight: 700;
    white-space: nowrap;
    color: #1a56db;
    width: 72pt;
  }
  .pt td { background: #fff; }

  /* 日常点検グリッド — 5列に変更してコンパクトに */
  .print-insp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1pt 3pt;
    border: 0.5pt solid #999;
    background: #fff;
    padding: 3pt 5pt;
    margin-bottom: 2pt;
  }
  .pi-item {
    font-size: 7.5pt;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pi-ok { color: #0e9f6e; font-weight: 600; }
  .pi-ng { color: #9ca3af; }
  .print-insp-note {
    font-size: 8pt;
    border: 0.5pt solid #999;
    padding: 2pt 5pt;
    margin-bottom: 2pt;
    background: #fffbeb;
  }

  /* 署名欄 */
  .print-sign th, .print-sign td {
    height: 28pt;
    font-size: 8pt;
  }
  .print-sign th { width: 90pt; }

  /* 改ページ制御 */
  .pt-section-title { page-break-inside: avoid; page-break-after: avoid; }
  table { page-break-inside: avoid; }
  .print-root > * { page-break-inside: avoid; }
}

/* ======================== RESPONSIVE (print-related) ======================== */
@media (max-width: 768px) {
  .section-header-right { align-items: flex-start; width: 100%; }
  .list-actions { justify-content: flex-start; }
  .csv-filter-row input[type="date"] { width: 120px; }
}

/* ======================== LOGIN SCREEN ======================== */
/* 初期は非表示。auth.js の _showLogin() で display:flex にする */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  background: linear-gradient(135deg, #1a3a8a 0%, #1a56db 50%, #2563eb 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 420px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1a56db, #3b82f6, #1a56db);
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.login-logo i { font-size: 28px; }

.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-wrap > i:first-child {
  position: absolute;
  left: 12px;
  color: var(--gray-400);
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}
.login-input-wrap input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.login-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
  background: #fff;
}
.login-eye-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  transition: color .15s;
}
.login-eye-btn:hover { color: var(--primary); }

.login-error {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 13px;
  margin-bottom: 14px;
  animation: fadeInDown .25s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-hint {
  margin-top: 20px;
  border-top: 1px solid var(--gray-200);
  padding-top: 14px;
}
.login-hint details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--gray-500);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.login-hint details summary::-webkit-details-marker { display: none; }
.login-hint details summary:hover { color: var(--primary); }

.hint-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}
.hint-table th, .hint-table td {
  border: 1px solid var(--gray-200);
  padding: 5px 8px;
  text-align: center;
}
.hint-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-600);
}

/* シェイクアニメーション（ログイン失敗時） */
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-8px); }
  40%, 80%  { transform: translateX(8px); }
}
.login-shake { animation: loginShake .45s ease; }

/* ======================== HEADER USER INFO ======================== */
.header-company-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c3d8f8;
  border-radius: 99px;
  padding: 2px 10px;
  margin-left: 4px;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-user-role {
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  padding: 2px 8px;
  margin-right: 2px;
}
.role-admin {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.role-driver {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

/* 管理者ボタン */
.btn-admin {
  background: linear-gradient(135deg, #92400e, #d97706);
  color: #fff;
  font-weight: 700;
}
.btn-admin:hover { background: linear-gradient(135deg, #78350f, #b45309); transform: translateY(-1px); }

/* スーパー管理者（開発者）ボタン */
.btn-superadmin {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
  color: #fff;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}
.btn-superadmin::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.15) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: superShimmer 2s linear infinite;
}
@keyframes superShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.btn-superadmin:hover { background: linear-gradient(135deg, #5b21b6, #6d28d9); transform: translateY(-1px); }
.role-superadmin {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
}

/* ======================== ADMIN VIEW ======================== */
#viewAdmin {
  display: none;
}
.admin-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.admin-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
}
.admin-section-title i { color: var(--primary); }

/* ユーザー一覧テーブル */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  border: 1px solid var(--gray-200);
  padding: 8px 12px;
  text-align: left;
}
.admin-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-700);
}
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table .badge-role-admin {
  display: inline-block;
  background: #fef3c7; color: #92400e;
  border-radius: 99px; padding: 1px 8px;
  font-size: 11px; font-weight: 700;
}
.admin-table .badge-role-driver {
  display: inline-block;
  background: #ede9fe; color: #5b21b6;
  border-radius: 99px; padding: 1px 8px;
  font-size: 11px; font-weight: 700;
}

/* ログイン画面スマホ対応 */
@media (max-width: 480px) {
  .login-card { padding: 28px 20px 22px; }
  .login-title { font-size: 18px; }
  .header-user-name { max-width: 80px; }
  .header-user-role { display: none; }
}

/* ======================== COMPLETE VIEW ======================== */
.complete-card {
  max-width: 520px;
  margin: 48px auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 48px 36px 40px;
  text-align: center;
  border-top: 5px solid var(--success);
}
.complete-icon {
  font-size: 64px;
  color: var(--success);
  margin-bottom: 16px;
  animation: completePop .5s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes completePop {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}
.complete-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
}
.complete-sub {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 20px;
}
.complete-time-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 24px;
}
.complete-time-notice i { font-size: 15px; }
.complete-expired {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 24px;
}
.complete-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-warning {
  background: var(--warning);
  color: #fff;
  font-weight: 700;
}
.btn-warning:hover { background: #b45309; transform: translateY(-1px); box-shadow: var(--shadow); }

/* ======================== ADMIN LOGIN MODAL ======================== */
.admin-login-box {
  max-width: 440px;
  border-top: 4px solid var(--warning);
}
.admin-login-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 4px;
}
.admin-login-header > i {
  font-size: 28px;
  color: var(--warning);
  margin-top: 2px;
  flex-shrink: 0;
}
.admin-login-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}
.admin-login-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 3px;
}

/* 管理者でログインボタン（アウトライン版） */
.btn-outline-admin {
  background: #fff;
  color: var(--warning);
  border: 1.5px solid var(--warning);
  font-weight: 600;
}
.btn-outline-admin:hover {
  background: #fffbeb;
  transform: translateY(-1px);
}

/* ======================== RESPONSIVE ADDITIONS ======================== */
@media (max-width: 768px) {
  .complete-card { margin: 24px 0; padding: 32px 20px; }
  .complete-actions { flex-direction: column; }
  .complete-actions .btn { width: 100%; justify-content: center; }
}

/* ======================== ADMIN ENHANCED UI ======================== */
.add-driver-info-box,
.add-company-info-box {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
  background: var(--primary-light);
  border: 1.5px solid #c3d8f8;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 4px;
}
.add-driver-info-box i,
.add-company-info-box i {
  color: var(--primary);
  margin-right: 4px;
}

/* ログインヒントノート */
.login-hint-note {
  font-size: 12px;
  color: var(--gray-500);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

/* ======================== SUPER ADMIN VIEW ======================== */
#viewSuperAdmin .admin-section-title i {
  color: #7c3aed;
}
#viewSuperAdmin .admin-section {
  border-top: 3px solid #7c3aed;
}

/* ======================== TUTORIAL VIEW ======================== */
.tutorial-hero {
  text-align: center;
  padding: 48px 24px 32px;
  background: linear-gradient(135deg, #1a3a8a 0%, #1a56db 60%, #3b82f6 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  margin-bottom: 32px;
}
.tutorial-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 20px;
  padding: 4px 18px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.tutorial-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
}
.tutorial-subtitle {
  font-size: 15px;
  opacity: .85;
}
.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tutorial-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}
.tutorial-step-num {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}
.tutorial-step-body { flex: 1; }
.tutorial-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tutorial-step-title i { color: var(--primary); }
.tutorial-step-desc {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.7;
}
.tutorial-account-box {
  margin-top: 16px;
  background: #f8faff;
  border: 1.5px solid #c3d8f8;
  border-radius: var(--radius);
  padding: 16px;
}
.tutorial-account-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tutorial-account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tutorial-account-table th,
.tutorial-account-table td {
  border: 1px solid var(--gray-200);
  padding: 7px 12px;
  text-align: left;
}
.tutorial-account-table th {
  background: var(--gray-100);
  font-weight: 600;
}
.tutorial-account-table code {
  background: #f1f5f9;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: monospace;
  font-weight: 600;
  color: #1a56db;
}
.badge-role-admin {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.badge-role-driver {
  display: inline-block;
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
@media (max-width: 640px) {
  .tutorial-title { font-size: 22px; }
  .tutorial-step { flex-direction: column; gap: 12px; }
  .tutorial-step-num { align-self: flex-start; }
  .tutorial-account-table { font-size: 12px; }
}

/* ======================== 写真アップロード UI ======================== */

/* アップロードエリア行（2枚横並び） */
.photo-upload-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* 各写真グループ */
.photo-upload-group {
  flex: 1;
  min-width: 140px;
  max-width: 300px;
}

/* ラベル */
.photo-upload-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}
.photo-upload-label i {
  color: var(--primary);
  margin-right: 4px;
}

/* アップロードエリア本体 */
.photo-upload-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 200px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  background: #f8faff;
  /* cursor はラベル側に委ねる */
  cursor: default;
  /* overflow:hidden を clip に変更 → label のクリックを遮断しない */
  overflow: clip;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

/* プレースホルダー */
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 12px;
  /* pointer-events:none を削除 → label が確実にタップを受け取る */
  user-select: none;
}
.photo-placeholder > i {
  /* アイコン自体はクリック不要なので none でOK */
  pointer-events: none;
  font-size: 28px;
  color: var(--gray-300);
}

/* プレビュー画像 */
.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 2px);
}

/* 削除ボタン */
.photo-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid #fff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 10;
  transition: background 0.2s;
}
.photo-remove-btn:hover {
  background: rgba(220, 38, 38, 0.9);
}

/* ─── 詳細表示の写真行 ─── */
.detail-photo-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}
.detail-photo-item {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
}
.detail-photo-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.detail-photo-label i {
  color: var(--primary);
  margin-right: 4px;
}
.detail-photo-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  cursor: zoom-in;
  transition: transform 0.15s, box-shadow 0.15s;
}
.detail-photo-img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ─── カメラ / ギャラリー ボタン行 ─── */
.photo-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
/* label要素をボタンとして使う ─ iOS Safari でも確実に動作 */
label.photo-action-btn,
.photo-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 18px;
  border-radius: 24px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.1s;
  white-space: nowrap;
  /* タッチ操作しやすい最小サイズ */
  min-height: 44px;
  min-width: 80px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(26,86,219,0.10);
  /* クリックを確実に受け取る */
  position: relative;
  z-index: 10;
  pointer-events: auto;
}
label.photo-action-btn:hover,
label.photo-action-btn:active,
.photo-action-btn:hover,
.photo-action-btn:active {
  background: var(--primary);
  color: #fff;
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(26,86,219,0.20);
}
label.photo-action-btn i,
.photo-action-btn i {
  font-size: 14px;
}

/* ─── 免許証アップロードエリア（横長） ─── */
.license-upload-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--gray-200);
}
.photo-upload-area--wide {
  aspect-ratio: 3 / 2;
  max-height: 180px;
}

/* ─── 任意バッジ ─── */
.photo-optional-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

/* 免許証詳細写真 */
.detail-photo-img--license {
  aspect-ratio: 3/2;
}

/* ─── レスポンシブ ─── */
@media (max-width: 500px) {
  .photo-upload-row { gap: 10px; }
  .photo-upload-group { min-width: 120px; }
  .detail-photo-row { gap: 10px; }
  .detail-photo-item { min-width: 120px; }
  .photo-action-btn { padding: 6px 10px; font-size: 11px; }
}

/* ═══════════════════════════════════════
   立替経費セクション
═══════════════════════════════════════ */
.expense-section {
  margin-top: 20px;
  padding: 16px;
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius-lg);
}
.expense-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.expense-total-badge {
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1.5px solid #fcd34d;
  border-radius: 20px;
  padding: 2px 14px;
}
.expense-detail-box {
  margin-top: 12px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
}
.expense-detail-title {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 10px;
}

/* ═══════════════════════════════════════
   デモ画面
═══════════════════════════════════════ */
.demo-hero {
  text-align: center;
  padding: 32px 16px 24px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #38bdf8 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  margin-bottom: 24px;
}
.demo-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.demo-title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 10px;
}
.demo-subtitle {
  font-size: 14px;
  opacity: 0.85;
  margin: 0 0 20px;
}
.demo-timer-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
}
.demo-timer-value {
  font-size: 20px;
  font-weight: 800;
  color: #fde68a;
}
.demo-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.demo-feature-card {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.demo-feature-icon {
  font-size: 28px;
  color: var(--primary);
}
.demo-feature-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}
.demo-feature-desc {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.6;
}
.demo-cta-box {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 2px solid #38bdf8;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}
.demo-cta-title {
  font-size: 18px;
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 8px;
}
.demo-cta-desc {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 16px;
}
.demo-account-box {
  background: #f8faff;
  border: 1.5px solid #c3d8f8;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  text-align: left;
}
.demo-account-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}
.demo-account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.demo-account-table th,
.demo-account-table td {
  border: 1px solid var(--gray-200);
  padding: 6px 10px;
  text-align: left;
}
.demo-account-table th {
  background: var(--gray-50);
  font-weight: 700;
}

/* ═══════════════════════════════════════
   配車カレンダー
═══════════════════════════════════════ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-nav-btn {
  background: none;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 16px;
  color: var(--gray-600);
  transition: background 0.15s;
}
.calendar-nav-btn:hover { background: var(--gray-100); }
.calendar-month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calendar-weekday {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
}
.calendar-weekday.sun { background: #dc2626; }
.calendar-weekday.sat { background: #2563eb; }
.calendar-day {
  min-height: 80px;
  border: 0.5px solid var(--gray-200);
  padding: 4px;
  background: #fff;
  vertical-align: top;
  cursor: pointer;
  transition: background 0.1s;
}
.calendar-day:hover { background: #f0f7ff; }
.calendar-day.other-month { background: #f9fafb; color: var(--gray-400); }
.calendar-day.today { background: #eff6ff; }
.calendar-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 3px;
}
.calendar-day.sun .calendar-day-num { color: #dc2626; }
.calendar-day.sat .calendar-day-num { color: #2563eb; }
.calendar-day.today .calendar-day-num {
  background: var(--primary);
  color: #fff;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.dispatch-chip {
  font-size: 10px;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  cursor: pointer;
}
.dispatch-chip.status-confirmed { background: #d1fae5; color: #065f46; }
.dispatch-chip.status-completed { background: #e5e7eb; color: #6b7280; }

/* 配車モーダル */
.dispatch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dispatch-modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.dispatch-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════
   月次明細・請求書
═══════════════════════════════════════ */
.monthly-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.monthly-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.monthly-card {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.monthly-card-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.monthly-card-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.monthly-card-unit {
  font-size: 12px;
  color: var(--gray-500);
}
.monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.monthly-table th,
.monthly-table td {
  border: 1px solid var(--gray-200);
  padding: 8px 10px;
  text-align: left;
}
.monthly-table th {
  background: var(--gray-50);
  font-weight: 700;
  white-space: nowrap;
}
.monthly-table tr:hover td { background: #f0f7ff; }
.monthly-table .amount-col { text-align: right; font-family: monospace; }
.monthly-table tfoot td {
  font-weight: 700;
  background: #eff6ff;
}

/* ═══════════════════════════════════════
   登録申請管理（総管理者）
═══════════════════════════════════════ */
.request-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.request-badge.pending  { background: #fef3c7; color: #92400e; }
.request-badge.approved { background: #d1fae5; color: #065f46; }
.request-badge.rejected { background: #fee2e2; color: #991b1b; }
.request-badge.demo     { background: #e0f2fe; color: #075985; }

/* ─── 登録ページ ─── */
.register-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.register-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.register-logo {
  text-align: center;
  margin-bottom: 24px;
}
.register-logo i {
  font-size: 40px;
  color: var(--primary);
}
.register-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  text-align: center;
  margin-bottom: 6px;
}
.register-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 24px;
}
.register-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  margin: 20px 0 12px;
}
.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
.plan-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.plan-card.selected {
  border-color: var(--primary);
  background: #eff6ff;
}
.plan-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.plan-card-price {
  font-size: 11px;
  color: var(--gray-500);
}

@media (max-width: 640px) {
  .demo-features { grid-template-columns: 1fr; }
  .calendar-grid { font-size: 11px; }
  .calendar-day { min-height: 60px; }
  .monthly-summary-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ======================== 請求書ビュー ======================== */
.invoice-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.invoice-status-draft    { background:#f3f4f6; color:#374151; }
.invoice-status-sent     { background:#eff6ff; color:#1a56db; }
.invoice-status-paid     { background:#d1fae5; color:#065f46; }
.invoice-status-cancelled{ background:#fee2e2; color:#991b1b; }

/* ======================== ログインヒント ======================== */
.login-hint-note a {
  color: var(--primary);
  text-decoration: none;
}
.login-hint-note a:hover { text-decoration: underline; }

/* ======================== スマホ総合対応 ======================== */

/* ヘッダー：スマホでボタンテキスト省略・折り返し対応 */
@media (max-width: 640px) {
  .header-inner {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .header-logo span { font-size: 14px; }
  .header-logo i { font-size: 18px; }
  .header-company-badge { display: none; }
  .header-actions {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .header-actions .btn {
    padding: 5px 8px;
    font-size: 11px;
    gap: 3px;
  }
  .header-user-name { display: none; }
  .header-user-role { font-size: 11px; padding: 2px 6px; }
  .main-content { padding: 12px 10px 80px; }
}

/* モーダル：スマホで全画面対応 */
@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    width: 100%;
    max-width: 100% !important;
    padding: 20px 16px 24px;
  }
  .modal-wide { max-width: 100% !important; }
  .modal-actions { flex-direction: column; gap: 8px; }
  .modal-actions .btn { width: 100%; justify-content: center; }
}

/* 管理者テーブル：スマホでスクロール */
@media (max-width: 640px) {
  .admin-table { font-size: 12px; }
  .admin-table th,
  .admin-table td { padding: 6px 8px; }
  .admin-section { padding: 14px 12px; }
  .admin-section-title { font-size: 14px; gap: 6px; flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* 配車カレンダー：スマホ最適化 */
@media (max-width: 480px) {
  .calendar-header { flex-direction: column; gap: 6px; align-items: flex-start; }
  .calendar-day { min-height: 50px; font-size: 11px; }
  .calendar-grid { gap: 2px; }
  .dispatch-item-dot { font-size: 10px; }
}

/* フォームセクション：スマホ */
@media (max-width: 480px) {
  .form-section { padding: 14px 12px; }
  .form-section-title { font-size: 14px; }
  .cargo-entry { padding: 12px; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
}

/* 日報一覧：スマホ */
@media (max-width: 480px) {
  .report-card-meta { flex-direction: column; gap: 4px; }
  .report-card-badges { flex-wrap: wrap; }
  .search-filter-bar { flex-direction: column; gap: 8px; }
  .search-bar { max-width: 100%; }
}

/* ログイン画面：スマホ小サイズ（6.5インチ相当 ≦ 430px） */
@media (max-width: 480px) {
  /* overlay をスクロール可能に。align-items:flex-start で上から表示 */
  .login-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 12px 12px 24px;
  }
  .login-card {
    padding: 20px 16px 16px;
    border-radius: 12px;
    /* スクロール余白を確保しつつ全幅 */
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }
  .login-logo { font-size: 16px; gap: 6px; margin-bottom: 4px; }
  .login-logo i { font-size: 22px; }
  .login-title { font-size: 17px; margin-bottom: 14px; letter-spacing: 1px; }
  /* 入力欄を少しコンパクトに */
  .login-input-wrap input { padding: 9px 36px 9px 34px; font-size: 14px; }
  .login-hint { font-size: 11px; }
  /* チュートリアルカード内のボタンは縦並び */
  #loginTutorialHint .btn { font-size: 11px; padding: 6px 8px; }
  /* ログインボタン */
  .btn-lg { font-size: 14px; padding: 11px 18px; }
}

@media (max-width: 380px) {
  .login-card { padding: 16px 12px 14px; border-radius: 10px; }
  .login-logo { font-size: 14px; }
  .login-title { font-size: 15px; }
  .btn-lg { font-size: 13px; padding: 10px 14px; }
}

/* 月次・出力ボタン群：スマホ */
@media (max-width: 640px) {
  .monthly-export-row { flex-direction: column; gap: 6px; }
  .monthly-export-row .btn { width: 100%; justify-content: center; }
}

