:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --success: #057a55;
  --warning: #e3a008;
  --danger: #e02424;
  --bg: #e9edf2;   /* カードとの差をはっきりさせるため、背景を少し濃いグレーに */
  --card-bg: #ffffff;
  --border: #d6dce4;
  --text: #111827;
  --text-muted: #6b7280;
  --nav-bg: #162032;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; }

/* ── サイドバー ────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; width: 220px; height: 100vh;
  background: var(--nav-bg); display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 16px 16px; color: white; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid #2a3a50; white-space: nowrap; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-section {
  padding: 16px 16px 4px; font-size: 10px; font-weight: 700;
  color: #6b8aaa; letter-spacing: 1px; text-transform: uppercase;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #e2e8f0; text-decoration: none;
  font-size: 13px; font-weight: 500; transition: all .15s;
}
.sidebar-link:hover { color: white; background: rgba(255,255,255,.1); }
.sidebar-link.active { color: white; background: rgba(26,86,219,.45); border-right: 3px solid #4d8af0; }
.sidebar-link.coming { color: #e2e8f0; }
.sidebar-link.coming:hover { color: white; background: rgba(255,255,255,.1); }
.sidebar-link.logout { color: #f87171; }
.sidebar-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-label { flex: 1; }
.sidebar-footer { border-top: 1px solid #2a3a50; padding: 8px 0; }
.coming-badge {
  display: inline-block; padding: 1px 5px; background: #374151;
  color: #6b7280; border-radius: 3px; font-size: 9px; font-weight: 600; letter-spacing: 0.3px;
}

/* ── レイアウト ────────────────────────── */
.main-content { margin-left: 220px; max-width: calc(1100px + 220px); padding: 24px 32px; }
.page-header { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-desc { color: var(--text-muted); margin-top: 4px; font-size: 13px; }
.company-badge { background: var(--primary); color: white; padding: 4px 10px;
                 border-radius: 20px; font-size: 12px; }

/* ── カード ────────────────────────────── */
.card { background: var(--card-bg); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
        box-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04); }
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px;
           padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card h3 { font-size: 14px; font-weight: 600; margin: 20px 0 10px; color: var(--text); }

/* ── 認証画面 ─────────────────────────── */
.auth-container { min-height: 100vh; display: flex; align-items: center;
                  justify-content: center; background: var(--nav-bg); }
.auth-card { background: white; border-radius: 12px; padding: 40px;
             width: 100%; max-width: 380px; }
.auth-logo { font-size: 40px; text-align: center; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.auth-link { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 13px; }
.auth-link a { color: var(--primary); }

/* ── フォーム ─────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500;
                    color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; transition: border .15s; }
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.required { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* ── ボタン ────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
       border-radius: var(--radius); font-size: 13px; font-weight: 500;
       cursor: pointer; border: none; text-decoration: none; transition: all .15s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 10px; }

/* ── ダッシュボード ────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: var(--radius);
             padding: 14px 20px; text-align: center; }
.stat-number { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-icon { font-size: 28px; }
.action-card { cursor: pointer; transition: all .15s; }
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { font-size: 16px; font-weight: 600; }
/* カード内の見出し行：下線は行全体に1本だけ引き、見出しと中身の間の余白を詰める
   （h2単体の下線・余白と重なって、見出しの下に短い線と大きな空白ができていたため） */
.card .section-header { margin-bottom: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.card .section-header h2 { margin: 0; padding: 0; border-bottom: none; }

/* ── テーブル ─────────────────────────── */
.table-container { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; overflow-y: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f3f4f6; padding: 10px 14px; text-align: left;
                  font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.yield { font-weight: 600; }
.yield-good { color: var(--success); }
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }
.empty-state .btn { margin-top: 12px; }

/* ── アップロードゾーン ────────────────── */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius);
               padding: 40px; text-align: center; cursor: pointer; transition: all .15s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: #eff6ff; }
.upload-icon { font-size: 40px; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 13px; }
.status-loading { color: var(--warning); padding: 8px; margin-top: 8px; }
.status-ok { color: var(--success); padding: 8px; margin-top: 8px; font-weight: 500; }
.status-error { color: var(--danger); padding: 8px; margin-top: 8px; }

/* ── 査定結果 ─────────────────────────── */
.result-yields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.yield-card { border-radius: var(--radius); padding: 20px; text-align: center; }
.yield-card.surface { background: #fffbeb; border: 1px solid #fcd34d; }
.yield-card.net { background: #ecfdf5; border: 1px solid #6ee7b7; }
.yield-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.yield-value { font-size: 32px; font-weight: 700; }
.yield-card.surface .yield-value { color: var(--warning); }
.yield-card.net .yield-value { color: var(--success); }
.yield-reason { font-size: 11px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }

.valuation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.val-card { background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.val-method { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.val-price { font-size: 18px; font-weight: 700; color: var(--primary); }
.val-reason { font-size: 11px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

.suggested-price { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius);
                   padding: 14px 20px; margin-bottom: 16px; font-size: 15px; }
.suggested-price strong { font-size: 20px; color: var(--primary); margin: 0 8px; }

.auction-ref { background: #fef3c7; border: 1px solid #fcd34d; border-radius: var(--radius);
               padding: 12px 16px; margin-bottom: 16px; font-size: 13px;
               display: flex; align-items: center; gap: 12px; }

.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.cost-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cost-table td:nth-child(2) { text-align: right; font-weight: 600; min-width: 100px; }
/* 物件情報：項目名のすぐ隣に内容を並べる（金額表のような右寄せにしない） */
.cost-table.info-table tbody { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; }
.cost-table.info-table tr { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.cost-table.info-table tr.full { grid-column: 1 / -1; }
.cost-table.info-table td { border-bottom: none; padding: 8px 6px; }
.cost-table.info-table td:first-child { width: 88px; flex-shrink: 0; color: var(--text-muted); white-space: nowrap; }
.cost-table.info-table td:nth-child(2) { text-align: left; min-width: 0; }
.cost-table.info-table tr.full td:first-child { width: auto; min-width: 88px; padding-right: 12px; }
@media (max-width: 1100px) { .cost-table.info-table tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .cost-table.info-table tbody { grid-template-columns: 1fr; } }
.reason-col { color: var(--text-muted); font-size: 11px; }
.total-row td { font-weight: 700; background: #f3f4f6; }

.external-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── 3方式まとめ枠 ─────────────────────────── */
.method-section-wrapper {
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
  background: white;
  margin-bottom: 20px;
}
.method-section-wrapper .method-block { margin-bottom: 12px; }
.method-section-wrapper .method-block:last-child { margin-bottom: 0; }

/* ── 査定方式ブロック ───────────────────────── */
.method-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.method-block-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; gap: 12px; }
.income-header { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.cost-header   { background: #f0fdf4; border-bottom: 1px solid #bbf7d0; }
.comp-header   { background: #faf5ff; border-bottom: 1px solid #e9d5ff; }
.method-name-badge { font-weight: 700; font-size: 13px; padding: 4px 14px; border-radius: 20px; }
.income-badge { background: #dbeafe; color: #1e40af; }
.cost-badge   { background: #d1fae5; color: #065f46; }
.comp-badge   { background: #ede9fe; color: #5b21b6; }
.method-result-price { font-size: 22px; font-weight: 700; color: var(--primary); }

.method-reason-box { padding: 14px 18px; border-bottom: 1px solid #f3f4f6; }
.reason-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.reason-text { font-size: 14px; line-height: 1.8; color: var(--text); }

.inline-link { color: var(--primary); text-decoration: underline; font-weight: 600; cursor: pointer; }
.inline-link:hover { opacity: 0.75; }

/* 積算価格 土地・建物詳細 */
.detail-section { padding: 14px 18px; border-top: 1px solid var(--border); }
.detail-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; padding: 4px 10px; background: #f9fafb; border-left: 3px solid var(--primary); border-radius: 0 4px 4px 0; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 8px 4px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #4b5563; flex: 1; line-height: 1.5; }
.detail-label small { display: block; font-size: 11px; color: #9ca3af; }
.detail-value-wrap { text-align: right; white-space: nowrap; }
.detail-value { font-weight: 600; display: block; }
.detail-note { font-size: 11px; color: #9ca3af; display: block; }
.detail-link { color: var(--primary); text-decoration: none; font-size: 11px; display: inline-block; margin-right: 8px; }
.detail-link:hover { text-decoration: underline; }
.copy-hint { font-size: 10px; color: #9ca3af; margin-top: 3px; }
.subtotal-row { background: #eff6ff; border-radius: 4px; padding: 10px 8px; margin-top: 6px; }
.subtotal-value { font-size: 18px; color: var(--primary); }

/* ── チャット ─────────────────────────── */
.chat-container { background: white; border: 1px solid var(--border);
                  border-radius: var(--radius); overflow: hidden; position: relative;
                  display: flex; flex-direction: column;
                  height: calc(100vh - 84px); min-height: 620px;
                  max-width: 900px; }
.chat-container.drag-over::after {
  content: '📎 ここに資料をドロップ';
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(79,70,229,0.08); border: 2px dashed var(--primary);
  font-size: 16px; font-weight: 700; color: var(--primary);
  pointer-events: none;
}
.chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; display: flex;
                 flex-direction: column; gap: 12px; }
.message { display: flex; }
.message.user { justify-content: flex-end; }
.msg-col { display: flex; flex-direction: column; max-width: 640px; }
.message.user .msg-col { align-items: flex-end; }
.message.assistant .msg-col { align-items: flex-start; }
.msg-time { font-size: 10.5px; color: var(--text-muted); margin: 3px 4px 0; }
.unread-marker { display: flex; align-items: center; gap: 8px; margin: -2px 0;
                 color: #dc2626; font-size: 11px; font-weight: 700; }
.unread-marker::before, .unread-marker::after { content: ''; flex: 1; height: 1px; background: #dc2626; opacity: 0.35; }
.msg-bubble { max-width: 640px; padding: 10px 14px; border-radius: 12px;
              line-height: 1.6; font-size: 13px; white-space: pre-wrap; }
.message.user .msg-bubble { background: var(--primary); color: white; border-radius: 12px 12px 2px 12px; }
.message.assistant .msg-bubble { background: #f3f4f6; border-radius: 2px 12px 12px 12px; white-space: normal; }
.message.assistant .msg-bubble h1, .message.assistant .msg-bubble h2, .message.assistant .msg-bubble h3 {
  margin: 10px 0 6px; line-height: 1.4; }
.message.assistant .msg-bubble h1:first-child, .message.assistant .msg-bubble h2:first-child, .message.assistant .msg-bubble h3:first-child { margin-top: 0; }
.message.assistant .msg-bubble h1 { font-size: 1.15em; }
.message.assistant .msg-bubble h2 { font-size: 1.08em; }
.message.assistant .msg-bubble h3 { font-size: 1.02em; }
.message.assistant .msg-bubble ul { margin: 4px 0 8px 1.2em; padding: 0; }
.message.assistant .msg-bubble li { margin: 2px 0; }
.message.assistant .msg-bubble p { margin: 0 0 8px; }
.message.assistant .msg-bubble p:last-child { margin-bottom: 0; }
.message.assistant .msg-bubble code { background: #e5e7eb; padding: 1px 4px; border-radius: 3px; font-size: 0.92em; }
.message.assistant .msg-bubble pre { background: #ffffff; color: var(--text); border: 1px solid #e2e8f0; border-left: 3px solid var(--primary);
  padding: 10px 14px; border-radius: 6px; overflow-x: auto; margin: 8px 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; }
.message.assistant .msg-bubble pre code { background: none; padding: 0; color: inherit; }
.message.assistant .msg-bubble strong { font-weight: 700; }
.message.assistant .msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.message.assistant .msg-bubble .ai-toc-toggle {
  display: inline-block; font-size: 11px; color: var(--primary); background: none;
  border: none; padding: 0; margin: 2px 0 8px; cursor: pointer; text-decoration: underline;
}
.message.assistant .msg-bubble .ai-section-top {
  border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; overflow: hidden;
}
.message.assistant .msg-bubble .ai-section-top-title {
  padding: 8px 12px; font-weight: 700; background: #eef2ff;
}
.message.assistant .msg-bubble details.ai-section {
  border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; overflow: hidden;
}
.message.assistant .msg-bubble details.ai-section summary {
  cursor: pointer; padding: 8px 12px; font-weight: 700; background: #eef2ff;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.message.assistant .msg-bubble details.ai-section summary::-webkit-details-marker { display: none; }
.message.assistant .msg-bubble details.ai-section summary::before {
  content: '▶'; font-size: 9px; color: #4f46e5; transition: transform .15s; flex-shrink: 0;
}
.message.assistant .msg-bubble details.ai-section[open] summary::before { transform: rotate(90deg); }
.message.assistant .msg-bubble .ai-section-top .ai-section-body,
.message.assistant .msg-bubble details.ai-section .ai-section-body { padding: 10px 12px; }
.message.assistant .msg-bubble .ai-section-top .ai-section-body > *:first-child,
.message.assistant .msg-bubble details.ai-section .ai-section-body > *:first-child { margin-top: 0; }
.message.assistant .msg-bubble .ai-section-top .ai-section-body > *:last-child,
.message.assistant .msg-bubble details.ai-section .ai-section-body > *:last-child { margin-bottom: 0; }
.message.assistant .msg-bubble details.ai-section-child summary { background: #f3f4f6; font-weight: 600; font-size: 0.96em; }
.message.assistant .msg-bubble details.ai-section-child summary::before { color: #6b7280; }
.message.assistant .msg-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 0.94em; }
.message.assistant .msg-bubble th, .message.assistant .msg-bubble td { border: 1px solid #e2e8f0; padding: 5px 9px; text-align: left; }
.message.assistant .msg-bubble th { background: #eef2ff; font-weight: 700; }
.chat-input-area { border-top: 1px solid var(--border); padding: 12px;
                   display: flex; gap: 10px; align-items: flex-end; flex-shrink: 0; }
.chat-input-area textarea { flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
                             padding: 8px 12px; font-size: 14px; resize: none; font-family: inherit; }
.chat-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px 0; flex-shrink: 0; }
.chat-search-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: #fafafa; flex-shrink: 0;
}
.chat-search-bar input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 13px; font-family: inherit;
}
.chat-search-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; min-width: 42px; text-align: center; }
mark.chat-search-hit { background: #fef08a; color: inherit; border-radius: 2px; }
mark.chat-search-hit-active { background: #fb923c; }
.chip {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background .15s; white-space: nowrap;
}
.chip:hover { background: #dbeafe; }
.chat-templates-wrap { position: relative; }
.chat-templates-menu {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 20;
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 10px; width: max-content; max-width: 320px;
  flex-direction: column; gap: 6px;
}
.chat-templates-menu.open { display: flex; }
.chat-templates-menu .chip { text-align: left; white-space: normal; }

/* ── 物件ステータス ────────────────────── */
.prop-status { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-new         { background: #f3f4f6; color: #6b7280; }
.status-inquiry,
.status-contacted   { background: #dbeafe; color: #1e40af; }
.status-visited     { background: #e0e7ff; color: #3730a3; }
.status-negotiating { background: #fef3c7; color: #92400e; }
.status-contracted  { background: #d1fae5; color: #065f46; }
.status-cancelled   { background: #fef2f2; color: #991b1b; }
.status-active      { background: #f3f4f6; color: #6b7280; }
.status-select { padding: 3px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; cursor: pointer; }
.status-inline {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; background: white;
  color: var(--text);
}

/* ── 連絡履歴 ─────────────────────────── */
.contact-log-list { display: flex; flex-direction: column; gap: 10px; }
.contact-log-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.contact-log-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; }
.contact-type-badge { padding: 2px 8px; border-radius: 20px; font-weight: 600; font-size: 11px; }
.ct-phone { background: #d1fae5; color: #065f46; }
.ct-email { background: #dbeafe; color: #1e40af; }
.ct-fax   { background: #fef3c7; color: #92400e; }
.ct-visit { background: #ede9fe; color: #5b21b6; }
.ct-other { background: #f3f4f6; color: #6b7280; }
.contact-direction { color: var(--text-muted); }
.contact-date { color: var(--text-muted); font-weight: 500; }
.contact-customer { color: var(--primary); }
.contact-log-summary { font-size: 14px; line-height: 1.6; color: var(--text); }

/* ── アラート ─────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* ── ユーティリティ ────────────────────── */
/* ── 物件一覧：フィルター・ソート・担当者 ─── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-input {
  flex: 0 1 280px; min-width: 160px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9rem;
}
.filter-select {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.9rem; background: white;
}
.filter-count { color: var(--text-muted); font-size: 0.85rem; margin-left: 4px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #f0f4ff; }
th.sort-asc .sort-icon, th.sort-desc .sort-icon { color: var(--primary); font-weight: bold; }
.assigned-display {
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
  display: inline-block; min-width: 60px;
}
.assigned-display:hover { background: #f0f4ff; }
.assigned-input {
  padding: 3px 6px; border: 1px solid var(--primary);
  border-radius: 4px; font-size: 0.9rem; width: 90px;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

/* ── レスポンシブ（スマホ）────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand { font-size: 0; padding: 18px 0; text-align: center; }
  .sidebar-brand::before { content: '🏠'; font-size: 22px; }
  .sidebar-section { display: none; }
  .sidebar-label { display: none; }
  .coming-badge { display: none; }
  .sidebar-link { justify-content: center; padding: 10px 0; }
  .sidebar-icon { width: auto; font-size: 20px; }
  .main-content { margin-left: 60px; padding: 16px; }
  .valuation-grid { grid-template-columns: 1fr; }
  .result-yields { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .msg-bubble { max-width: 85%; }
}

/* ── 入力方法タブ（査定画面）────────────── */
.input-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  transition: color 0.15s;
}
.input-tab:hover { color: var(--primary); }
.input-tab-active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; font-weight: 700; }

/* ── 物件の添付資料一覧：広い画面では2列、狭い画面では1列 ── */
.pf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.pf-grid #pf-empty { grid-column: 1 / -1; }
@media (max-width: 1100px) { .pf-grid { grid-template-columns: 1fr; } }

/* ── 金額表（ランニングコスト・諸費用など）：明細書のように「項目名は左・金額は右」、計算根拠はその行の下に小さく ──
   カードを左右2枚並べて幅を半分にし、項目名と金額が離れすぎないようにしている */
.cost-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.cost-pair > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .cost-pair { grid-template-columns: 1fr; } }
.cost-table.calc-table, .cost-table.calc-table tbody { display: block; }
.cost-table.calc-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; border-bottom: 1px solid var(--border); }
.cost-table.calc-table td { border-bottom: none; padding: 9px 10px; }
.cost-table.calc-table td:first-child { color: var(--text); }
.cost-table.calc-table td:nth-child(2) { text-align: right; white-space: nowrap; font-weight: 600; }
.cost-table.calc-table td:nth-child(3) { grid-column: 1 / -1; padding: 0 10px 9px; font-size: 12px; color: var(--text-muted); line-height: 1.6; font-weight: 400; text-align: left; }
.cost-table.calc-table td:nth-child(3):empty { display: none; }
.cost-table.calc-table td:nth-child(3) .reason-text { margin-top: 0 !important; font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* 項目名と内容の表（元付業者など）：内容を項目名のすぐ右に左寄せで並べる */
.cost-table.kv-table td:first-child { width: 1%; padding-right: 24px; color: var(--text-muted); white-space: nowrap; }
.cost-table.kv-table td:nth-child(2) { text-align: left; }
