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

body {
  font-family: 'Noto Sans JP', 'Meiryo', sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
}

a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ナビゲーション */
.nav {
  background: #1a3a5c;
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 24px;
}
.nav-brand { font-size: 18px; font-weight: bold; color: #fff; }
.nav a { color: #cce0ff; font-size: 14px; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav-logout { margin-left: auto; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 5px 14px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.nav-logout:hover { background: rgba(255,255,255,.25); }

/* ページコンテナ */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* カード */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  padding: 24px;
  margin-bottom: 16px;
}

/* ボタン */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-success { background: #34a853; color: #fff; }
.btn-danger  { background: #ea4335; color: #fff; }
.btn-outline { background: #fff; color: #555; border: 1px solid #ccc; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* フォーム */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 500; }
.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: #1a73e8; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* 検索バー */
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.search-bar .form-group { margin-bottom: 0; }
.search-bar input, .search-bar select { width: auto; }
#q { width: 220px; }

/* テーブル */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #f0f4f8; text-align: left; padding: 10px 12px; font-size: 12px; color: #555; border-bottom: 2px solid #dde; }
td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
tr:hover td { background: #fafbff; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ステータスバッジ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
}
.badge-draft    { background: #e8eaf6; color: #3949ab; }
.badge-submitted { background: #fff3e0; color: #e65100; }
.badge-approved  { background: #e8f5e9; color: #2e7d32; }
.badge-rejected  { background: #ffebee; color: #c62828; }

/* 見積書編集フォーム */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.col-span-2 { grid-column: span 2; }

/* 明細テーブル */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { background: #f0f4f8; padding: 8px; font-size: 12px; }
.items-table td { padding: 4px; border-bottom: 1px solid #eee; }
.items-table input, .items-table select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
}
.items-table input:focus, .items-table select:focus { outline: none; border-color: #1a73e8; }
.item-name-col { min-width: 160px; }
.item-desc-col { min-width: 200px; }
.item-num-col  { width: 70px; }
.item-price-col { width: 110px; }
.item-tax-col  { width: 70px; }
.item-amt-col  { width: 110px; }
.item-del-col  { width: 36px; }

/* 合計欄 */
.totals { float: right; width: 300px; }
.totals table { width: 100%; }
.totals td { padding: 6px 10px; }
.totals .total-row { font-weight: bold; font-size: 16px; background: #f0f4f8; }
.clearfix::after { content: ''; display: block; clear: both; }

/* 印刷用プレビュー */
.quote-preview {
  background: #fff;
  padding: 40px;
  max-width: 860px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.preview-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.preview-title { text-align: center; font-size: 28px; font-weight: bold; letter-spacing: .5em; margin: 16px 0 24px; }
.preview-meta { display: flex; justify-content: space-between; margin-bottom: 24px; }
.preview-customer { font-size: 18px; font-weight: bold; border-bottom: 2px solid #333; padding-bottom: 4px; margin-bottom: 12px; }
.preview-company { font-size: 13px; line-height: 1.8; }
.preview-subject { margin-bottom: 6px; }
.preview-subject-label { font-size: 13px; }
.preview-total-box {
  display: inline-flex;
  align-items: center;
  border: 2px solid #333;
  padding: 8px 20px;
  margin-bottom: 16px;
  gap: 16px;
  font-size: 15px;
}
.preview-total-box .amount { font-size: 20px; font-weight: bold; }
.preview-items { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 13px; }
.preview-items th { background: #f0f0f0; border: 1px solid #999; padding: 6px 8px; text-align: center; }
.preview-items td { border: 1px solid #ccc; padding: 6px 8px; }
.preview-items .desc-row td { background: #fafafa; color: #555; border-top: none; font-size: 12px; padding-left: 20px; }
.preview-tax-section { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; font-size: 13px; }
.preview-tax-detail { border: 1px solid #ccc; }
.preview-tax-detail td { padding: 5px 10px; border: 1px solid #ccc; }
.preview-tax-detail th { padding: 5px 10px; background: #f0f0f0; text-align: center; font-size: 12px; }
.preview-summary td { padding: 6px 12px; text-align: right; }
.preview-summary .total-row { font-weight: bold; background: #f0f0f0; }
.preview-notes { border: 1px solid #ccc; padding: 12px; font-size: 12px; line-height: 1.7; }
.preview-notes-title { text-align: center; background: #f0f0f0; padding: 4px; margin-bottom: 8px; font-weight: bold; }

/* 空状態 */
.empty { text-align: center; padding: 60px; color: #aaa; }

/* ページタイトル */
.page-title { font-size: 20px; font-weight: bold; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }

/* レスポンシブ */
@media (max-width: 700px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .totals { float: none; width: 100%; }
}

@media print {
  .nav, .no-print { display: none !important; }
  body { background: #fff; }
  .quote-preview { box-shadow: none; padding: 0; }
}
