/* ===========================
   ダッシュボード固有スタイル
   =========================== */

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-card-period {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--content-bg);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.donut-chart-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.donut-canvas-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.donut-canvas-wrap canvas {
  width: 160px !important;
  height: 160px !important;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
}

.donut-num {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.donut-legend {
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-count {
  margin-left: auto;
  font-weight: 500;
  color: var(--text-primary);
}

.chart-link {
  display: inline-block;
  font-size: 12px;
  color: var(--accent-blue);
  text-decoration: none;
  margin-top: 6px;
  font-weight: 500;
}

.chart-link:hover {
  text-decoration: underline;
}

/* ===========================
   ダッシュボード下段
   =========================== */
.dashboard-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.bottom-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.bottom-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bottom-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===========================
   お知らせセクション
   =========================== */
.notice-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.notice-list {}

.notice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f3f8;
  cursor: pointer;
  transition: background 0.1s;
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-item:hover {
  background: #f8fafd;
  margin: 0 -8px;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
}

.notice-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.notice-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.notice-arrow {
  font-size: 18px;
  color: var(--text-muted);
}

/* ===========================
   工事案件管理スタイル
   =========================== */
.project-status-施工中 { background:#dcfce7; color:#16a34a; }
.project-status-着工前 { background:#dbeafe; color:#2563eb; }
.project-status-完工   { background:#f0fdf4; color:#16a34a; border:1px solid #bbf7d0; }
.project-status-引渡済 { background:#ede9fe; color:#7c3aed; }
.project-status-見積中 { background:#ffedd5; color:#ea580c; }

/* ===========================
   工事案件詳細スタイル
   =========================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  cursor: pointer;
}

.breadcrumb:hover {
  color: var(--accent-blue);
}

.breadcrumb svg {
  width: 14px;
  height: 14px;
}

.detail-hero {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.detail-hero-img {
  width: 100px;
  height: 75px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.detail-hero-img svg {
  width: 40px;
  height: 40px;
  color: var(--accent-blue);
}

.detail-hero-info {
  flex: 1;
}

.detail-hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-hero-meta {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.detail-hero-meta span {
  white-space: nowrap;
}

.detail-hero-meta strong {
  color: var(--text-primary);
}

.detail-actions {
  flex-shrink: 0;
}

/* タブメニュー */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.detail-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.detail-tab:hover {
  color: var(--text-primary);
}

.detail-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
}

/* 基本情報タブコンテンツ */
.detail-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.detail-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.info-table {
  width: 100%;
}

.info-table tr td {
  padding: 7px 0;
  font-size: 13px;
  vertical-align: top;
  border: none;
}

.info-table tr td:first-child {
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
  font-weight: 500;
}

.info-table tr td:last-child {
  color: var(--text-primary);
  font-weight: 400;
}

/* 利益サマリー */
.profit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.profit-item {
  background: #f8fafd;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
}

.profit-item-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.profit-item-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.profit-item.highlight {
  background: var(--accent-blue-light);
  border-color: #93c5fd;
}

.profit-item.highlight .profit-item-value {
  color: var(--accent-blue);
}

.profit-item.highlight2 {
  background: #dcfce7;
  border-color: #86efac;
}

.profit-item.highlight2 .profit-item-value {
  color: var(--accent-green);
}

.profit-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 原価構成・工期進捗 */
.detail-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* 工期進捗タイムライン */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.timeline-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 20px;
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
}

.timeline-dot.done {
  background: var(--accent-green);
}

.timeline-dot.progress {
  background: var(--accent-blue);
}

.timeline-dot.pending {
  background: #e5e9f2;
  border: 2px solid var(--border-color);
}

.timeline-line {
  width: 2px;
  height: 24px;
  background: var(--border-color);
  margin-top: 2px;
}

.timeline-item:last-child .timeline-line {
  display: none;
}

.timeline-body {
  flex: 1;
  padding-top: 1px;
}

.timeline-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.timeline-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.timeline-status.done { background: var(--accent-green-light); color: var(--accent-green); }
.timeline-status.progress { background: var(--accent-blue-light); color: var(--accent-blue); }
.timeline-status.pending { background: var(--accent-gray-light); color: var(--accent-gray); }

/* 関連ショートカット */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.shortcut-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.shortcut-item:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.shortcut-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-blue-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

.shortcut-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}

.shortcut-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.shortcut-desc {
  font-size: 10px;
  color: var(--text-secondary);
}

/* ===========================
   協力業者請求管理スタイル
   =========================== */
.invoice-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}

.invoice-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 76px;
}

.invoice-sidebar-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafd;
}

.invoice-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.invoice-sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
}

.invoice-sidebar-body {
  padding: 18px;
}

.invoice-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f3f8;
}

.invoice-detail-row:last-of-type {
  border-bottom: none;
}

.invoice-detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.invoice-detail-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.invoice-detail-value.total {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-blue);
}

.invoice-attachments {
  margin-top: 14px;
  margin-bottom: 14px;
}

.invoice-attachments-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafd;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.attachment-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.attachment-icon.pdf { background: #fee2e2; color: var(--accent-red); }
.attachment-icon.excel { background: #dcfce7; color: var(--accent-green); }

.attachment-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
}

.attachment-size {
  font-size: 11px;
  color: var(--text-secondary);
}

.attachment-download {
  font-size: 12px;
  color: var(--accent-blue);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.invoice-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.invoice-actions .btn {
  flex: 1;
  justify-content: center;
}

.invoice-return-reason {
  margin-top: 12px;
}

.invoice-return-reason label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.invoice-return-reason textarea {
  width: 100%;
  height: 80px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  resize: none;
  transition: border-color 0.15s;
}

.invoice-return-reason textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.invoice-return-reason .char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 3px;
}

.no-detail-msg {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
