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

body {
  font-family: "Hiragino Sans", "Meiryo", sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  font-size: 15px;
}

.app-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

header {
  background: #2563eb;
  color: #fff;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 14px;
  border-left: 4px solid #2563eb;
  padding-left: 8px;
}

/* フォーム */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1e293b;
  transition: border-color 0.2s;
  width: 100%;
  background: #f8fafc;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-unit input {
  width: 100px;
}

.unit {
  font-size: 0.9rem;
  color: #64748b;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ボタン */
.btn {
  padding: 10px 22px;
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-secondary {
  background: #e2e8f0;
  color: #475569;
}

.btn-save {
  background: #16a34a;
  color: #fff;
}

/* プレビュー */
.preview-section {
  display: none;
}

.preview-section.visible {
  display: block;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-header h2 {
  margin-bottom: 0;
}

.preview-actions {
  display: flex;
  gap: 10px;
}

/* 日報レイアウト */
.report {
  border: 2px solid #1e293b;
  padding: 24px;
  background: #fff;
}

.report-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #1e293b;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.report-table th,
.report-table td {
  border: 1px solid #94a3b8;
  padding: 10px 12px;
  vertical-align: top;
}

.report-table th {
  background: #f1f5f9;
  font-weight: 600;
  width: 110px;
  white-space: nowrap;
}

.report-table .tall-cell {
  min-height: 80px;
  height: 80px;
}

/* 保存済み一覧 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-info {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.history-date {
  font-weight: 700;
  color: #2563eb;
  font-size: 0.9rem;
}

.history-site {
  color: #475569;
  font-size: 0.9rem;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.empty-message {
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* レスポンシブ */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: 1;
  }

  .preview-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-table th {
    width: 80px;
    font-size: 0.82rem;
  }

  .report-table td {
    font-size: 0.88rem;
  }
}

/* 印刷スタイル */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 12pt;
  }

  .app-wrapper {
    max-width: 100%;
    padding: 0;
  }

  section {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: transparent;
  }

  .preview-section {
    display: block !important;
  }

  .report {
    border: 2px solid #000;
    page-break-inside: avoid;
  }

  .report-title {
    font-size: 16pt;
  }

  .report-table th,
  .report-table td {
    border: 1px solid #000;
    font-size: 11pt;
  }
}
