/* 取引管理デモ — お気に入り一覧カードUI準拠 */

.demo-deals-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  overflow-x: hidden;
}

.demo-deals-page-head__title {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--dash-text, #1e293b);
}

.demo-deals-page-head__sub {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--dash-muted, #64748b);
  line-height: 1.55;
}

.demo-deals-panel {
  background: #fff;
  border: 1px solid #e8e4dc;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.demo-deals-panel__head {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid #e8e4dc;
  background: #fafaf8;
}

.demo-deals-panel__count {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: #1e293b;
}

.demo-deals-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-deal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 120px;
  padding: 20px 24px;
  border-bottom: 1px solid #e8e4dc;
  box-sizing: border-box;
}

.demo-deal-card:last-child {
  border-bottom: 0;
}

.demo-deal-card__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.demo-deal-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.demo-deal-card__tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.demo-deal-card__tag--status {
  color: #0d9488;
  background: #ecfdf5;
  border-color: #99f6e4;
}

.demo-deal-card__tag--warn {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
}

.demo-deal-card__tag--done {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.demo-deal-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  color: #1e293b;
}

.demo-deal-card__meta {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.45;
}

.demo-deal-card__amount {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #9a6a00;
  letter-spacing: 0.02em;
}

.demo-deal-card__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.demo-deal-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.demo-deal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 800;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.demo-deal-btn--ghost {
  color: #1e293b;
  border-color: #e2e8f0;
  background: #fff;
}

.demo-deal-btn--ghost:hover {
  background: #f8fafc;
}

.demo-deal-btn--gold {
  color: #9a6a00;
  border: 1px solid rgba(184, 134, 11, 0.45);
  background: #fff;
}

.demo-deal-btn--gold:hover {
  background: #fff7df;
}

.demo-deal-btn--chat {
  color: #0f766e;
  border: 1px solid rgba(13, 148, 136, 0.35);
  background: #f0fdfa;
}

.demo-deal-btn--chat:hover {
  background: #ccfbf1;
}

.demo-deal-btn--pay {
  color: #fff;
  border-color: #0d9488;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}

.demo-deal-btn--pay:hover {
  filter: brightness(1.05);
}

.demo-deal-btn--paid {
  color: #64748b;
  border-color: #e2e8f0;
  background: #f1f5f9;
  cursor: default;
}

.demo-deals-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
}

/* ── 進行中案件カード（デモ / Supabase差し替え想定） ── */

.demo-deals-list--progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.demo-deal-card--progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
}

.demo-progress-deal-card {
  display: block;
  padding: 15px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8edf3;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
}

a.demo-progress-deal-card {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

a.demo-progress-deal-card:active {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  border-color: #dbeafe;
}

.demo-progress-deal-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.demo-progress-deal-card__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1.4;
  color: #0f172a;
}

.demo-progress-deal-card__status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
}

.demo-progress-deal-card__status--working {
  color: #1d4ed8;
  background: #eff6ff;
}

.demo-progress-deal-card__status--estimate {
  color: #c2410c;
  background: #fff7ed;
}

.demo-progress-deal-card__status--delivery {
  color: #15803d;
  background: #ecfdf5;
}

.demo-progress-deal-card__rows {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-progress-deal-card__row {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0;
}

.demo-progress-deal-card__row dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.demo-progress-deal-card__row dd {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.45;
}

.demo-progress-deal-card__row--progress dd {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-progress-deal-card__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.demo-progress-deal-card__progress-track {
  flex: 1;
  min-width: 0;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.demo-progress-deal-card__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.demo-progress-deal-card__progress-value {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: #1d4ed8;
}

.demo-deal-card--progress-wrap .demo-deal-card__aside--progress {
  padding: 0 16px 16px;
}

/* 案件詳細（deal-detail.html） */
.deal-detail-layout {
  max-width: 720px;
}

.demo-deals-page-back {
  margin-left: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
}

.demo-deals-page-back:hover {
  color: #1d4ed8;
}

.deal-detail-head {
  margin-bottom: 1.25rem;
}

.deal-detail-head__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.deal-detail-head__updated {
  font-size: 0.8125rem;
  color: #64748b;
}

.deal-detail-head__title {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.35;
  color: #0f172a;
}

.deal-detail-head__client {
  margin: 0;
  font-size: 0.9375rem;
  color: #475569;
}

.deal-detail-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.deal-detail-panel__label {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #64748b;
}

.deal-detail-panel__progress {
  max-width: 100%;
}

.deal-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.deal-detail-note {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.deal-detail-panel--completion {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.deal-detail-panel--highlight {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.deal-detail-completion__lead {
  margin: 0 0 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #334155;
}

.deal-detail-completion__rows {
  margin: 0 0 1rem;
  display: grid;
  gap: 0.625rem;
}

.deal-detail-completion__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.deal-detail-completion__row dt {
  margin: 0;
  color: #64748b;
  font-weight: 700;
}

.deal-detail-completion__row dd {
  margin: 0;
  color: #0f172a;
}

.deal-detail-actions--completion {
  margin-top: 0.25rem;
}

.deal-detail-actions--client,
.deal-detail-actions--client-bottom,
.deal-detail-actions--worker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.deal-detail-actions--client .demo-deal-btn,
.deal-detail-actions--client-bottom .demo-deal-btn {
  flex: 1 1 calc(50% - 0.35rem);
  min-width: 7.5rem;
  justify-content: center;
  text-align: center;
}

.deal-detail-actions--client .demo-deal-btn--chat,
.deal-detail-actions--client-bottom .demo-deal-btn:last-child:nth-child(odd) {
  flex-basis: 100%;
}

.deal-detail-actions--worker .demo-deal-btn {
  flex: 1 1 calc(33.333% - 0.45rem);
  min-width: 6.5rem;
  justify-content: center;
  text-align: center;
}

.demo-deal-btn--outline {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
}

.demo-deal-btn--outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.deal-detail-panel__label--completion {
  font-size: 1rem;
  color: #0f172a;
}

.deal-detail-note--completion-focus {
  margin-top: 0.5rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

body.deal-detail-page--completion-focus .deal-detail-panel--completion {
  margin-top: 0.25rem;
}

.deal-builder-card {
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.deal-builder-card--completion {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.deal-builder-card--auxiliary {
  border-style: dashed;
  background: #f8fafc;
}

.deal-builder-card--highlight {
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.24),
    0 10px 24px rgba(15, 23, 42, 0.08);
  animation: deal-builder-card-pulse 0.85s ease-out 2;
}

@keyframes deal-builder-card-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0.35),
      0 10px 24px rgba(15, 23, 42, 0.08);
  }
  70% {
    box-shadow:
      0 0 0 12px rgba(37, 99, 235, 0),
      0 10px 24px rgba(15, 23, 42, 0.08);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0),
      0 10px 24px rgba(15, 23, 42, 0.08);
  }
}

.deal-builder-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 800;
  color: #0f172a;
}

.deal-builder-card__title--sub {
  font-size: 0.9375rem;
  color: #475569;
}

.deal-builder-card__lead {
  margin: 0 0 0.875rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #64748b;
}

.deal-detail-focus-banner {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.875rem;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.45;
}

.deal-detail-head--compact {
  margin-bottom: 0.75rem;
}

.deal-detail-actions--project,
.deal-detail-actions--auxiliary {
  margin-top: 0.25rem;
}

body.deal-detail-page--notify-focus .deal-detail-layout {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.deal-detail-empty {
  padding: 2rem 0;
  text-align: center;
}

.deal-detail-empty__title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 800;
}

.deal-detail-empty__text {
  margin: 0 0 1rem;
  color: #64748b;
}

@media (max-width: 960px) {
  .deal-detail-layout {
    padding: 0 14px 1rem;
  }

  body.tasu-app-mobile-page[data-page="deal-detail"] .tasu-mobile-shell-head {
    min-height: 48px;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
  }

  body.tasu-app-mobile-page[data-page="deal-detail"] .tasu-mobile-page-head__title {
    font-size: 1rem;
  }

  .deal-detail-actions--client,
  .deal-detail-actions--client-bottom,
  .deal-detail-actions--worker {
    flex-direction: column;
  }

  .deal-detail-actions--client .demo-deal-btn,
  .deal-detail-actions--client-bottom .demo-deal-btn,
  .deal-detail-actions--worker .demo-deal-btn {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .deal-detail-completion__row {
    grid-template-columns: 5rem 1fr;
  }

  body.deal-detail-page--completion-focus .deal-detail-layout {
    padding-bottom: 0.5rem;
  }

  .demo-deals-page-back {
    display: none;
  }
}

.demo-deals-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.demo-deals-modal[hidden] {
  display: none;
}

.demo-deals-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.demo-deals-modal__panel {
  position: relative;
  width: min(100%, 360px);
  padding: 1.25rem 1.35rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
}

.demo-deals-modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.demo-deals-modal__body {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
}

.demo-deals-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #d6a72f, #a97600);
  cursor: pointer;
}

@media (max-width: 768px) {
  .demo-deal-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 24px;
  }

  .demo-deals-list--progress {
    padding: 0;
    gap: 10px;
  }

  .demo-deal-card--progress-wrap {
    padding: 0;
    border-bottom: 0;
  }

  .demo-deal-card--progress-wrap .demo-deal-card__aside--progress {
    padding: 0;
  }

  .demo-deal-card__aside {
    align-items: stretch;
  }

  .demo-deal-card__actions {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .demo-deal-card__actions .demo-deal-btn {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 42px;
    padding: 0.5rem 0.35rem;
    font-size: 0.75rem;
  }

  .demo-deal-card__actions--triple .demo-deal-btn {
    flex: 1 1 33%;
    min-height: 42px;
    font-size: 0.6875rem;
    padding: 0.5rem 0.25rem;
  }
}

@media (max-width: 960px) {
  body.tasu-mdetail-page[data-page="demo-progress"] .demo-deal-card--progress-wrap .demo-deal-card__aside--progress {
    display: none !important;
  }

  body.tasu-mdetail-page[data-page="demo-progress"] .demo-progress-mobile-body .demo-deals-list--progress {
    padding: 0;
    gap: 12px;
  }

  body.tasu-mdetail-page[data-page="demo-progress"] .tasu-mdetail-section:has(.demo-progress-mobile-body) {
    padding: 14px;
  }

  body.tasu-mdetail-page[data-page="demo-progress"] .tasu-mdetail-section:has(.demo-progress-mobile-body) .tasu-mdetail-section__label {
    margin-bottom: 10px;
  }
}
