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

body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 22px;
  margin-bottom: 16px;
  color: #1a1a2e;
  border-bottom: 2px solid #1a1a2e;
  padding-bottom: 8px;
}

/* セクション */
.section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.section h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: #444;
}

/* フォーム行 */
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.form-row label {
  min-width: 90px;
  font-weight: bold;
  color: #555;
  font-size: 13px;
}

.form-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.form-row input:focus {
  outline: none;
  border-color: #1a1a2e;
}

/* 品目追加フォーム */
.item-form {
  display: flex;
  flex-direction: column;
}

/* ボタン */
.btn-add {
  padding: 10px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
}

.btn-add:hover {
  background: #2d2d4e;
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-print {
  flex: 1;
  padding: 12px;
  background: #2c6e49;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}

.btn-print:hover {
  background: #1e4d33;
}

.btn-clear {
  padding: 12px 20px;
  background: #fff;
  color: #c0392b;
  border: 1px solid #c0392b;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.btn-clear:hover {
  background: #fdf0ee;
}

/* 納品書プレビュー */
.invoice-preview {
  padding: 24px;
}

.invoice-title {
  font-size: 22px;
  text-align: center;
  letter-spacing: 8px;
  margin-bottom: 20px;
  color: #111;
}

.invoice-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.client-name {
  font-size: 16px;
  font-weight: bold;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
  margin-bottom: 8px;
  min-width: 200px;
}

.invoice-meta-right {
  text-align: right;
  line-height: 1.8;
  color: #555;
  font-size: 13px;
}

/* 品目テーブル */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.invoice-table th,
.invoice-table td {
  border: 1px solid #ccc;
  padding: 8px 10px;
  text-align: center;
}

.invoice-table th {
  background: #f0f0f0;
  font-size: 13px;
  color: #444;
}

.col-no { width: 40px; }
.col-name { text-align: left !important; }
.col-qty { width: 70px; }
.col-price { width: 100px; }
.col-total { width: 110px; }
.col-action { width: 60px; }

.empty-msg {
  text-align: center !important;
  color: #aaa;
  font-size: 13px;
  padding: 20px !important;
}

/* 削除ボタン */
.btn-delete {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}

.btn-delete:hover {
  color: #962d22;
}

/* 集計 */
.invoice-summary {
  display: flex;
  justify-content: flex-end;
}

.summary-table {
  border-collapse: collapse;
  min-width: 250px;
}

.summary-table td {
  border: 1px solid #ccc;
  padding: 8px 14px;
}

.summary-table td:first-child {
  background: #f0f0f0;
  text-align: right;
  font-size: 13px;
  color: #555;
}

.summary-table td:last-child {
  text-align: right;
  min-width: 110px;
}

.total-row td {
  font-weight: bold;
  font-size: 16px;
  background: #1a1a2e !important;
  color: #fff !important;
}

/* ===== 印刷スタイル ===== */
@media print {
  body {
    background: #fff;
  }

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

  h1 {
    display: none;
  }

  .no-print {
    display: none !important;
  }

  .section {
    border: none;
    border-radius: 0;
    padding: 8px 0;
    margin-bottom: 8px;
    box-shadow: none;
  }

  .invoice-preview {
    border: none !important;
    padding: 0;
  }

  .invoice-table th,
  .invoice-table td {
    font-size: 12px;
    padding: 6px 8px;
  }

  .summary-table td {
    font-size: 12px;
  }
}

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row label {
    min-width: unset;
  }

  .form-row input {
    width: 100%;
  }

  .invoice-meta {
    flex-direction: column;
  }

  .invoice-meta-right {
    text-align: left;
  }

  .col-no,
  .col-action {
    width: 36px;
  }

  .col-qty,
  .col-price,
  .col-total {
    width: 70px;
  }

  .invoice-table th,
  .invoice-table td {
    padding: 6px 4px;
    font-size: 12px;
  }
}
