:host { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.detail-container { display: flex; flex-direction: column; height: 100%; background: #f8fafc; }

/* Header */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: #0f172a;
  color: #fff;
  flex-shrink: 0;
}

.header-left { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }

.request-code-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: #334155;
  color: #7dd3fc;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  margin-top: 4px;
}

.header-titles { flex: 1; min-width: 0; }
.header-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; line-height: 1.3; color: #f1f5f9; }

.header-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  background: #1e293b;
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 12px;
  .chip-icon { font-size: 12px; height: 12px; width: 12px; }
}

.header-actions { display: flex; gap: 4px; align-items: flex-start; flex-shrink: 0;
  button { color: #94a3b8; &:hover { color: #f1f5f9; } }
}

/* Tabs */
.detail-tabs {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  ::ng-deep .mat-mdc-tab-body-wrapper { flex: 1; overflow: hidden; }
  ::ng-deep .mat-mdc-tab-body-content { height: 100%; overflow-y: auto; }
  ::ng-deep .mat-mdc-tab-labels { background: #fff; border-bottom: 1px solid #e2e8f0; }
}

.tab-icon { font-size: 16px; height: 16px; width: 16px; margin-right: 4px; vertical-align: middle; }

.tab-content { padding: 20px; max-width: 1200px; }

/* Overview grid */
.overview-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }
.overview-main { display: flex; flex-direction: column; gap: 16px; }

.field-block { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  font-weight: 600;
}
.field-text { font-size: 14px; color: #374151; line-height: 1.6; margin: 0; white-space: pre-wrap; }

.keyword-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kw-chip {
  font-size: 12px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

/* Sidebar */
.overview-sidebar { display: flex; flex-direction: column; gap: 12px; }

.meta-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}
.meta-key { color: #6b7280; font-size: 12px; flex-shrink: 0; }
.meta-val { color: #1e293b; font-weight: 500; text-align: right; }
.meta-val.linked { color: #7c3aed; cursor: pointer; }

/* Readiness card */
.readiness-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}
.readiness-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 8px; }
.small-btn { width: 28px; height: 28px; line-height: 28px; mat-icon { font-size: 16px; } }
.readiness-score { font-size: 32px; font-weight: 700; line-height: 1; margin-bottom: 8px; }
.readiness-bar-wrap { height: 6px; background: #e2e8f0; border-radius: 3px; margin-bottom: 12px; overflow: hidden; }
.readiness-bar { height: 100%; border-radius: 3px; transition: width 0.4s; }

.score-green { color: #059669; }
.score-amber { color: #d97706; }
.score-red   { color: #dc2626; }
.score-green .readiness-bar, .readiness-bar.score-green { background: #059669; }
.score-amber .readiness-bar, .readiness-bar.score-amber { background: #d97706; }
.score-red .readiness-bar, .readiness-bar.score-red { background: #dc2626; }

.readiness-items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px;
  li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280;
    mat-icon { font-size: 14px; height: 14px; width: 14px; }
    &.passed { color: #059669; mat-icon { color: #059669; } }
  }
}

.readiness-btn { width: 100%; font-size: 13px; color: #475569; mat-icon { font-size: 16px; vertical-align: middle; } }

/* Skeleton */
.skeleton-wrap { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.skel-line { height: 16px; background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; border-radius: 4px; animation: skel 1.2s infinite; &:nth-child(odd) { width: 80%; } }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Timeline */
.timeline-list { padding: 8px 0; }
.timeline-entry { display: flex; gap: 12px; padding: 8px 0; }
.tl-icon-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-icon { font-size: 20px; height: 20px; width: 20px; border-radius: 50%; padding: 4px; background: #f1f5f9; }
.tl-line { flex: 1; width: 2px; background: #e2e8f0; margin-top: 4px; min-height: 20px; }
.tl-body { flex: 1; padding-bottom: 12px; }
.tl-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 2px; }
.tl-status { font-weight: 600; font-size: 13px; color: #1e293b; }
.tl-date { font-size: 12px; color: #94a3b8; }
.tl-from { font-size: 12px; color: #6b7280; margin-bottom: 2px; .tl-from-status { font-weight: 500; } }
.tl-user { font-size: 12px; color: #475569; font-weight: 500; }
.tl-comments { font-size: 13px; color: #374151; margin-top: 4px; background: #f8fafc; padding: 6px 10px; border-radius: 6px; border-left: 3px solid #e2e8f0; }

/* Checklist */
.checklist-table {
  table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
  th { text-align: left; padding: 8px 12px; background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: #6b7280; border-bottom: 1px solid #e2e8f0; }
  td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #374151; vertical-align: middle; }
  .completed-row { background: #f0fdf4; td { color: #6b7280; text-decoration: line-through; text-decoration-color: #86efac; } }
}
.chk-icon { font-size: 18px; height: 18px; width: 18px; color: #94a3b8; &.done { color: #059669; } }
.chk-name { font-weight: 500; }
.stage-badge { font-size: 11px; background: #ede9fe; color: #5b21b6; padding: 2px 6px; border-radius: 4px; }
.mand-icon { color: #dc2626; font-size: 16px; height: 16px; width: 16px; }
.text-muted { color: #94a3b8; }

/* Duplicates */
.dup-table-wrap { overflow-x: auto; }
.dup-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);

  th { text-align: left; padding: 8px 12px; background: #fff8f0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: #78350f; border-bottom: 1px solid #fde68a; }
  td { padding: 10px 12px; border-bottom: 1px solid #fffbeb; font-size: 13px; color: #374151; vertical-align: top; }
}
.score-bar-wrap { display: flex; align-items: center; gap: 8px; width: 100px; }
.score-bar { height: 6px; border-radius: 3px; flex-shrink: 0; }
.score-green-bar { background: #059669; }
.score-amber-bar { background: #d97706; }
.score-red-bar   { background: #dc2626; }
.score-val { font-size: 12px; font-weight: 600; color: #374151; white-space: nowrap; }
.dup-title { font-weight: 500; margin-bottom: 2px; }
.dup-code { font-size: 11px; font-family: monospace; color: #0369a1; background: #e0f2fe; padding: 1px 4px; border-radius: 3px; width: fit-content; }
.suggest-text { font-size: 12px; color: #6b7280; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
  &.badge-red   { background: #fee2e2; color: #b91c1c; }
  &.badge-amber { background: #fef3c7; color: #92400e; }
  &.badge-teal  { background: #d1fae5; color: #065f46; }
}

/* Subscribers */
.sub-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
  .sub-count { font-size: 13px; color: #6b7280; }
}
.sub-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);

  th { text-align: left; padding: 8px 12px; background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: #6b7280; border-bottom: 1px solid #e2e8f0; }
  td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #374151; }
}
.sub-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar-icon { color: #94a3b8; font-size: 20px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
  mat-icon { font-size: 40px; height: 40px; width: 40px; display: block; margin: 0 auto 10px; }
  p { font-size: 14px; margin: 0; }
}

/* Status / Priority badges (re-declared for use in dialog) */
.status-badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.priority-badge { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.st-gray       { background: #f3f4f6; color: #6b7280; }
.st-amber      { background: #fef3c7; color: #92400e; }
.st-teal       { background: #ccfbf1; color: #065f46; }
.st-red        { background: #fee2e2; color: #991b1b; }
.st-purple     { background: #ede9fe; color: #5b21b6; }
.st-green      { background: #d1fae5; color: #065f46; }
.st-green-dark { background: #064e3b; color: #a7f3d0; }
.pr-low      { background: #f3f4f6; color: #6b7280; }
.pr-medium   { background: #dbeafe; color: #1d4ed8; }
.pr-high     { background: #fef3c7; color: #b45309; }
.pr-critical { background: #fee2e2; color: #b91c1c; }
