/* 見積(quotes)機能 専用スタイル。kmf.css の共通トップバーの下で使う。 */
.kmf-flashes { max-width: 1100px; margin: 16px auto 0; padding: 0 20px; }
.kmf-flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 8px; font-size: .88rem; }
.kmf-flash-success { background: #dcfce7; color: #15803d; }
.kmf-flash-danger { background: #fee2e2; color: #b91c1c; }
.kmf-flash-info { background: #dbeafe; color: #1d4ed8; }

.qt-page { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.qt-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid #e5e7eb; }
.qt-nav a { padding: 10px 14px; color: #475569; text-decoration: none; font-size: .9rem; border-bottom: 2px solid transparent; }
.qt-nav a.active, .qt-nav a:hover { color: #1a73e8; border-bottom-color: #1a73e8; }

.qt-title { font-size: 1.35rem; font-weight: 700; color: #1e293b; margin: 0 0 16px; }
.qt-subtitle { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 28px 0 12px; }
.qt-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.qt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-bottom: 24px; }
.qt-card { display: block; text-align: center; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 10px; text-decoration: none; }
.qt-card-num { font-size: 1.6rem; font-weight: 700; color: #1a73e8; }
.qt-card-label { font-size: .82rem; color: #64748b; margin-top: 4px; }
.qt-card-total .qt-card-num { color: #1e293b; }

.qt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.qt-panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.qt-panel h2 { font-size: .95rem; margin: 0 0 10px; color: #334155; }

.qt-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .88rem; }
.qt-table th, .qt-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f5; text-align: left; }
.qt-table th { color: #64748b; font-weight: 600; background: #f8fafc; }
.qt-table-sm { margin: 10px 0 20px; }
.qt-table a { color: #1a73e8; text-decoration: none; }
.qt-empty { text-align: center; color: #94a3b8; padding: 18px 0; }

.qt-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.qt-filter input, .qt-filter select { padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .88rem; }

.qt-btn { display: inline-block; padding: 8px 14px; border-radius: 7px; font-size: .85rem; border: 1px solid #e2e8f0; background: #f1f5f9; color: #334155; text-decoration: none; cursor: pointer; }
.qt-btn:hover { background: #e2e8f0; }
.qt-btn-primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.qt-btn-primary:hover { background: #1662c4; }
.qt-btn-sm { padding: 4px 10px; font-size: .78rem; }

.qt-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; background: #e2e8f0; color: #334155; }
.qt-badge-draft { background: #e2e8f0; color: #475569; }
.qt-badge-submitted { background: #dbeafe; color: #1d4ed8; }
.qt-badge-won { background: #dcfce7; color: #15803d; }
.qt-badge-lost { background: #fee2e2; color: #b91c1c; }

.qt-pager { display: flex; gap: 6px; margin-top: 14px; align-items: center; justify-content: center; }
.qt-pager a { padding: 6px 11px; border: 1px solid #e2e8f0; border-radius: 6px; color: #334155; text-decoration: none; font-size: .85rem; }
.qt-pager a.active { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.qt-pager-current { padding: 6px 11px; color: #64748b; font-size: .85rem; }

/* 見積一覧のツールバー (絞り込み + 新規作成/Excel出力) */
.qt-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; background: #fff; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.qt-toolbar .qt-filter { margin-bottom: 0; align-items: center; }
.qt-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qt-filter-label { font-size: .78rem; color: #64748b; }
.qt-filter input[name=q] { min-width: 240px; }
.qt-input-sm { max-width: 110px; }
.qt-clear { font-size: .78rem; color: #64748b; text-decoration: underline; }
.qt-btn-excel { background: #059669; border-color: #059669; color: #fff; font-weight: 600; }
.qt-btn-excel:hover { background: #047857; }
.qt-btn-new { background: #10b981; border-color: #10b981; color: #fff; font-weight: 600; }
.qt-btn-new:hover { background: #059669; }
.qt-btn-machining { background: #f59e0b; border-color: #f59e0b; color: #fff; font-weight: 600; }
.qt-btn-machining:hover { background: #d97706; }
.qt-btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 600; }
.qt-btn-danger:hover:not(:disabled) { background: #b91c1c; }
.qt-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.qt-count { font-size: .78rem; color: #64748b; margin: 0 4px 8px; }
.qt-right { text-align: right; }
.qt-table th.qt-right, .qt-table td.qt-right { text-align: right; }
.qt-row-link { cursor: pointer; }
.qt-row-link:hover td { background: #f8fafc; }
.qt-badge-type-turning { background: #e0f2fe; color: #0369a1; }
.qt-badge-type-machining { background: #fef3c7; color: #b45309; }
.qt-adjusted-mark { font-size: .68rem; color: #b45309; background: #fef3c7; border-radius: 3px; padding: 1px 4px; margin-left: 4px; vertical-align: middle; }
.qt-empty-box { background: #fff; padding: 60px 20px; text-align: center; color: #94a3b8; border-radius: 10px; }
.qt-empty-box a { color: #1a73e8; }

/* ───── 安全品質 (ダッシュボード・掲示ボード・月報・ヒヤリ報告・選択肢マスタ) ───── */
.az-kpi-row, .az-board-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.az-kpi { background: #fff; border-radius: 10px; padding: 12px 14px; }
.az-kpi-label { font-size: .74rem; color: #64748b; margin-bottom: 6px; }
.az-kpi-value { font-size: 1.6rem; font-weight: 700; color: #1e293b; line-height: 1.1; }
.az-kpi-unit { font-size: .78rem; font-weight: 500; color: #64748b; }
.az-kpi-alert .az-kpi-value { color: #dc2626; }
.az-kpi-big .az-kpi-value { font-size: 2.4rem; color: #15803d; }
.az-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.az-bar { display: inline-block; height: 10px; border-radius: 999px; background: #93c5fd; min-width: 2px; vertical-align: middle; }
.az-bar-shikumi { background: #fdba74; }
.az-cause { margin-bottom: 10px; }
.az-cause-head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: 3px; }
.az-shikumi { font-size: .66rem; color: #b45309; background: #fef3c7; border-radius: 3px; padding: 1px 4px; margin-left: 5px; }
.az-th-shikumi { background: #fffbeb !important; color: #b45309 !important; }
.az-desc { color: #475569; }
.az-up { color: #dc2626; }
.az-down { color: #15803d; }
.az-board-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #1e293b; padding-bottom: 6px; margin-bottom: 14px; }
.az-board-head h2 { margin: 0; font-size: 1.1rem; }
.az-chips-label { font-size: .74rem; color: #64748b; margin: 12px 0 6px; }
.az-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.az-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 999px; font-size: .84rem; cursor: pointer; background: #fff; }
.az-chip input { accent-color: #1a73e8; }
.az-chip:has(input:checked) { border-color: #1a73e8; background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.az-chip-anzen:has(input:checked) { border-color: #15803d; background: #f0fdf4; color: #15803d; }
.az-chip-hinshitsu:has(input:checked) { border-color: #b45309; background: #fffbeb; color: #b45309; }
.az-hiyari textarea { width: 100%; }
.az-inline-form { display: inline-flex; gap: 6px; align-items: center; }
.az-inline-form input[type=text] { padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 5px; font-size: .84rem; }
.az-add-form { margin-top: 10px; }
.az-move { white-space: nowrap; }

@media print {
  .az-noprint, .koin-sidebar, .sidebar-overlay, .koin-topbar { display: none !important; }
  .az-board { padding: 0; }
  .az-board .qt-panel { break-inside: avoid; box-shadow: none; border: 1px solid #cbd5e1; }
  #main-content { margin: 0 !important; padding: 0 !important; }
}

/* マシニング加工内容編集 (面加工・穴加工グリッド + 集計カード) */
.qt-machining-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .qt-machining-grid { grid-template-columns: 1fr; } }
.qt-grid-table { font-size: .82rem; }
.qt-grid-table th { font-size: .72rem; line-height: 1.3; text-align: center; }
.qt-grid-table td { padding: 4px 5px; }
.qt-grid-table input { width: 100%; padding: 5px 6px; border: 1px solid #e2e8f0; border-radius: 5px; font-size: .82rem; box-sizing: border-box; }
.qt-grid-table input[type=number] { text-align: right; }
.qt-calc { text-align: right; background: #f8fafc; font-weight: 600; color: #0369a1; }
.qt-total-row td { background: #f1f5f9; font-weight: 700; text-align: right; }
.qt-total-row td:first-child { text-align: left; }
.qt-del-btn { border: none; background: none; color: #cbd5e1; cursor: pointer; font-size: .9rem; padding: 2px 4px; }
.qt-del-btn:hover { color: #dc2626; background: #fef2f2; border-radius: 4px; }
.qt-add-bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.qt-type-picker { padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .8rem; max-width: 280px; }
.qt-summary-card { position: sticky; top: 16px; }
.qt-summary-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.qt-summary-table th { text-align: left; padding: 7px 8px; border-bottom: 1px solid #f1f5f9; color: #64748b; font-weight: 500; width: 58%; }
.qt-summary-table td { text-align: right; padding: 7px 8px; border-bottom: 1px solid #f1f5f9; font-weight: 600; }
.qt-summary-table tr.qt-em td { color: #0369a1; }
.qt-summary-table tr.qt-total th, .qt-summary-table tr.qt-total td { background: #fef2f2; color: #dc2626; font-size: 1rem; font-weight: 700; border-bottom: 2px solid #dc2626; }
.qt-checkbox { flex-direction: row; align-items: center; gap: 8px; }

.qt-picker { margin-top: 6px; }
.qt-mono { font-family: Consolas, "Courier New", monospace; font-size: .8rem; }
.qt-warn { color: #b45309; }
.qt-note-box { background: #eff6ff; border-left: 3px solid #2563eb; padding: 10px 14px; font-size: .82rem; color: #1e40af; margin-bottom: 16px; border-radius: 0 4px 4px 0; }

/* 元図面プレビュー */
.qt-drawing { background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.qt-drawing-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.qt-drawing-frame { width: 100%; height: 640px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.qt-drawing-img { max-width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; }

.qt-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.qt-form label, .qt-full { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: #334155; margin-bottom: 14px; }
.qt-form input, .qt-form select, .qt-form textarea { padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .9rem; font-family: inherit; }
.qt-form .qt-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.qt-form-actions { display: flex; gap: 10px; margin-top: 10px; }
.qt-hint { font-size: .76rem; color: #94a3b8; font-weight: 400; }

.qt-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; margin-bottom: 10px; }
.qt-detail-grid div { font-size: .88rem; color: #334155; }
.qt-detail-grid b { display: block; font-size: .74rem; color: #94a3b8; font-weight: 600; margin-bottom: 2px; }
.qt-adjusted b, .qt-adjusted { color: #dc2626 !important; }

.qt-status-actions { display: flex; gap: 8px; margin: 14px 0; }
.qt-actions { display: flex; gap: 8px; }

.qt-op-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.qt-op-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qt-op-label { font-weight: 600; color: #1e293b; font-size: .92rem; }
.qt-row-actions { display: flex; gap: 10px; }
.qt-row-actions button { background: none; border: none; color: #dc2626; cursor: pointer; padding: 0; font-size: .85rem; }
.qt-calc-result { background: #f8fafc; border-radius: 8px; padding: 10px 14px; font-size: .85rem; color: #334155; margin: 6px 0 14px; }

/* 一括削除用チェックボックス */
input[type="checkbox"].qt-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: #1a73e8; }
.qt-row-checkbox { margin: 0; }
.qt-table tbody tr:has(.qt-row-checkbox:checked) { background: #eff6ff; }

/* CRM 図面見積依頼からの取り込み */
.qt-badge-crm { background: #ede9fe; color: #6d28d9; font-weight: 600; }
.qt-due { display: inline-block; margin-left: 6px; font-size: .72rem; color: #b45309; }
.qt-btn-sub { font-size: .72rem; color: #64748b; margin-left: 4px; }
.qt-crm-panel { background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 18px; }
.qt-crm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .88rem; }
.qt-crm-head a { color: #6d28d9; }
.qt-crm-panel .qt-hint { margin: 6px 0 0; }

/* 詳細画面の「一覧に戻る」 */
.qt-back { margin-bottom: 10px; }
.qt-btn-back { display: inline-flex; align-items: center; gap: 4px; }
