/* ==========================================================
   見積・請求管理 — 帳票（A4）用スタイル
   ========================================================== */

:root {
  --ink: #1f2a27;
  --line: #c8cfcc;
  --accent: #0e7a65;
  --font: "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #e8ebea;
  font-family: var(--font);
  color: var(--ink);
  font-size: 10.5pt;
  line-height: 1.6;
}

.toolbar {
  max-width: 210mm;
  margin: 0 auto;
  padding: 14px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toolbar a { color: var(--accent); text-decoration: none; font-size: 13px; }
.toolbar a:hover { text-decoration: underline; }

.toolbar button {
  padding: 9px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.toolbar button:hover { background: #0a5d4d; }

.sheet {
  width: 210mm;
  min-height: 296mm;
  margin: 0 auto 30px;
  background: #fff;
  padding: 18mm 16mm;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}

/* ---------- ヘッダ ---------- */

.doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10mm;
}

.doc-head h1 {
  margin: 0;
  font-size: 22pt;
  font-weight: 700;
  letter-spacing: 0.5em;
  border-bottom: 3px double var(--ink);
  padding-bottom: 2mm;
  padding-left: 0.25em;
}

.doc-meta { border-collapse: collapse; font-size: 9.5pt; }
.doc-meta th {
  text-align: left;
  font-weight: 600;
  color: #5c6a66;
  padding: 1px 4mm 1px 0;
}
.doc-meta td { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 宛先・発行者 ---------- */

.parties {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-bottom: 6mm;
}

.party-to { flex: 1; }
.to-name {
  margin: 0 0 1mm;
  font-size: 14pt;
  font-weight: 700;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1.5mm;
}
.to-addr { margin: 1mm 0 0; font-size: 9.5pt; }

.party-from { width: 62mm; font-size: 9pt; }
.party-from p { margin: 0.5mm 0; }
.from-name { font-size: 11.5pt; font-weight: 700; margin-bottom: 1mm !important; }

/* ---------- 金額 ---------- */

.greeting { margin: 0 0 4mm; }

.total-box {
  display: flex;
  align-items: baseline;
  gap: 8mm;
  border: 2px solid var(--ink);
  padding: 3mm 6mm;
  margin-bottom: 6mm;
  width: 110mm;
}

.total-box-label { font-size: 11pt; font-weight: 700; }
.total-box-value {
  font-size: 19pt;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.total-box-value small { font-size: 9pt; font-weight: 400; }

.subject { border-collapse: collapse; margin-bottom: 6mm; font-size: 10pt; }
.subject th {
  text-align: left;
  font-weight: 600;
  color: #5c6a66;
  padding: 1mm 6mm 1mm 0;
  vertical-align: top;
  white-space: nowrap;
}
.subject td { padding: 1mm 0; }
.subject .bank { line-height: 1.5; }

/* ---------- 明細 ---------- */

.items { width: 100%; border-collapse: collapse; margin-bottom: 4mm; font-size: 9.5pt; }

.items th {
  background: #eef3f1;
  border: 1px solid var(--line);
  padding: 2mm 2.5mm;
  font-weight: 600;
  font-size: 9pt;
}

.items td { border: 1px solid var(--line); padding: 1.8mm 2.5mm; }

.items .c-qty { width: 16mm; }
.items .c-unit { width: 14mm; }
.items .c-price { width: 26mm; }
.items .c-amount { width: 30mm; }

.items .num { text-align: right; font-variant-numeric: tabular-nums; }
.items .center { text-align: center; }
.items .filler td { height: 7mm; }

.reduced { color: var(--accent); font-weight: 700; }

/* ---------- 合計 ---------- */

.totals-area {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8mm;
  margin-bottom: 8mm;
}

.reduced-note { margin: 0 auto 0 0; font-size: 8.5pt; color: #5c6a66; }

.totals { border-collapse: collapse; width: 72mm; font-size: 10pt; }
.totals th, .totals td { padding: 1.6mm 2.5mm; border-bottom: 1px solid var(--line); }
.totals th { text-align: left; font-weight: 600; }
.totals td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals .sub th, .totals .sub td { font-size: 8.5pt; color: #5c6a66; font-weight: 400; }
.totals .grand th, .totals .grand td {
  font-size: 12pt;
  font-weight: 700;
  border-top: 2px solid var(--ink);
  border-bottom: none;
}

/* ---------- 備考 ---------- */

.note-box { border: 1px solid var(--line); padding: 3mm 4mm; }
.note-box h2 { margin: 0 0 1mm; font-size: 9pt; color: #5c6a66; }
.note-box p { margin: 0; font-size: 9.5pt; }

/* ---------- 印刷 ---------- */

@page { size: A4; margin: 0; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .sheet { margin: 0; box-shadow: none; width: auto; min-height: auto; }
}
