/* Model detail (/models/{org}/{name}). Builds on home.css tokens and changes.css badges. */

/* Breadcrumb */
.pd-crumbs ol {
  list-style: none; margin: 0; padding: 22px 0 0; display: flex; flex-wrap: wrap; align-items: center;
  font-size: 14px; line-height: 20px; color: var(--pd-ink-3);
}
.pd-crumbs li { display: flex; align-items: center; min-width: 0; }
.pd-crumbs li + li::before {
  content: ""; width: 6px; height: 6px; margin: 0 15px 0 11px;
  border-top: 1.5px solid #A3AEC2; border-right: 1.5px solid #A3AEC2; transform: rotate(45deg);
}
.pd-crumbs a { transition: color .15s ease; }
.pd-crumbs a:hover { color: var(--pd-blue); }
.pd-crumbs [aria-current] { color: var(--pd-blue); font-weight: 500; overflow-wrap: anywhere; }

/* Identity */
.pd-model-head { display: flex; align-items: flex-start; gap: 23px; margin-top: 23px; }
.pd-model-avatar {
  position: relative; overflow: hidden; flex: none; width: 76px; height: 76px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -0.02em;
}
.pd-model-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px;
  background: #fff; border: 1px solid var(--pd-line); border-radius: inherit;
}
.pd-model-id { min-width: 0; padding-top: 5px; }
.pd-model-id h1 {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin: 0;
  font-size: 31px; line-height: 1.2; font-weight: 800; letter-spacing: -0.025em; color: var(--pd-ink);
}
.pd-model-id h1 > span { overflow-wrap: anywhere; }
.pd .pd-model-ext { display: inline-flex; color: var(--pd-blue); transition: color .15s ease; }
.pd .pd-model-ext:hover { color: var(--pd-purple); }
.pd-model-sub { margin: 7px 0 0; font-size: 15.5px; line-height: 1.45; color: var(--pd-ink-2); }

.pd-model-meta {
  list-style: none; margin: 13px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  font-size: 13.5px; color: var(--pd-ink);
}
.pd-model-meta li { display: inline-flex; align-items: center; gap: 7px; }
.pd-model-meta a { display: inline-flex; align-items: center; gap: 7px; transition: color .15s ease; }
.pd-model-meta a:hover { color: var(--pd-blue); }
.pd-model-task { padding: 3px 11px; border-radius: 7px; background: #EDF1F8; color: var(--pd-ink-2); font-size: 13px; }
.pd-model-hf { font-size: 17px; line-height: 1; }
.pd-model-stat .icon { color: var(--pd-ink-2); }
.pd-model-meta li.pd-model-stat:not(.pd-model-stat + .pd-model-stat) { padding-left: 22px; border-left: 1px solid var(--pd-line); }

/* Tabs */
.pd-tabs {
  display: flex; gap: 31px; margin-top: 21px; border-bottom: 1px solid var(--pd-line);
  overflow-x: auto; scrollbar-width: none;
}
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-tabs a {
  position: relative; flex: none; padding: 0 6px 11px; font-size: 15.5px; line-height: 22px; font-weight: 500;
  color: var(--pd-ink); white-space: nowrap; transition: color .15s ease;
}
.pd-tabs a:hover, .pd-tabs a.is-active { color: var(--pd-blue); }
.pd-tabs a.is-active { font-weight: 600; }
.pd-tabs a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--pd-blue);
}

/* Shared card pieces */
.pd-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pd-model h2 { margin: 0; font-size: 19px; line-height: 1.3; font-weight: 700; letter-spacing: -0.012em; color: var(--pd-ink); }

.pd-chip {
  display: inline-flex; align-items: center; padding: 2px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap;
}
.pd-chip-neutral { background: #EDF1F8; color: #33415C; }
.pd-chip-success { background: #E6F8EF; color: var(--pd-success-ink); }
.pd-chip-warn { background: var(--pd-warn-pale); color: var(--pd-warn-ink); }

.pd-model .pd-type {
  padding: 2px 11px; border-radius: 6px; border-color: transparent; background: #EDF1F8; color: #33415C;
  font-size: 13px; line-height: 20px;
}
.pd-model .pd-sev { gap: 7px; padding: 2px 11px 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 20px; }
.pd-model .pd-sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pd-sev-info { background: #F1F4F9; color: var(--pd-ink-2); }

/* Current status + quick actions */
.pd-model-top { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 17px; margin-top: 19px; }

.pd-status { padding: 19px 20px 22px 22px; }
.pd-status-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--pd-ink-2); }
.pd-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pd-success); flex: none; }
.pd-status-rows { margin: 11px 0 0; }
.pd-status-rows > div {
  display: grid; grid-template-columns: 269px minmax(0, 1fr); align-items: center; min-height: 34px;
  border-bottom: 1px solid var(--pd-line-2);
}
.pd-status-rows > div:last-child { border-bottom: 0; }
.pd-status-rows dt { font-size: 14px; color: #33415C; }
.pd-status-rows dd { display: flex; align-items: center; gap: 12px; min-width: 0; margin: 0; font-size: 14px; color: var(--pd-ink); }
.pd .pd-status-link { color: var(--pd-blue-2); overflow-wrap: anywhere; }
.pd .pd-status-link:hover { text-decoration: underline; }
.pd .pd-status-ext { display: inline-flex; color: var(--pd-blue-2); }

.pd-actions { padding: 19px 20px 18px; }
.pd-actions ul { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 9px; }
.pd-action {
  display: flex; align-items: center; gap: 19px; height: 47px; padding: 0 16px 0 18px;
  background: #fff; border: 1px solid var(--pd-line); border-radius: 8px;
  font-size: 14.5px; font-weight: 500; color: var(--pd-ink);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.pd .pd-action:hover { border-color: #C9D2FF; background: #F8F9FF; color: var(--pd-blue); }
.pd-action-chev { margin-left: auto; color: var(--pd-ink-2); }
.pd-action:hover .pd-action-chev { color: var(--pd-blue); }
.pd-action-btn { width: 100%; font-family: inherit; text-align: left; cursor: pointer; }
.pd-action-watching { border-color: #BDEBD5; background: var(--pd-success-pale); color: var(--pd-success-ink); }
.pd .pd-action-watching:hover { border-color: #BDEBD5; background: var(--pd-success-pale); color: var(--pd-success-ink); }
.pd .pd-action-manage { margin-left: auto; font-size: 13.5px; font-weight: 600; color: var(--pd-blue); }
.pd .pd-action-manage:hover { text-decoration: underline; }
.pd-action-rev { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 2px 4px; font-size: 13px; color: var(--pd-ink-2); }
.pd-action-rev code { font-family: var(--pd-mono); font-size: 12.5px; color: var(--pd-ink); }
.pd-action-rev-note { flex-basis: 100%; font-size: 12.5px; color: var(--pd-ink-3); }

/* Change history */
.pd-history { margin-top: 18px; padding: 16px 18px 20px 22px; }
.pd-history-filters { display: flex; gap: 9px; }
.pd-history .pd-select { flex: 0 0 143px; }
.pd-history .pd-select:nth-child(2) { flex-basis: 158px; }
.pd-history .pd-select select { height: 32px; padding: 0 32px 0 17px; border-radius: 7px; font-size: 13.5px; }
.pd-history .pd-select .icon { right: 13px; }
.pd-history-range {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 9px 12px;
  background: var(--pd-blue-pale); border: 1px solid #DCE2FF; border-radius: 8px;
  font-size: 13.5px; color: var(--pd-ink-2);
}
.pd-history-range .icon { color: var(--pd-blue); }
.pd-history-range strong { color: var(--pd-ink); font-weight: 600; }
.pd .pd-history-range a { margin-left: auto; color: var(--pd-blue); font-weight: 600; }
.pd-history-empty p { margin: 16px 0 4px; font-size: 14px; color: var(--pd-ink-2); }
.pd .pd-history-empty a { color: var(--pd-blue); font-weight: 600; }

.pd-timeline { position: relative; list-style: none; margin: 12px 0 0; padding: 0; }
.pd-timeline::before {
  content: ""; position: absolute; left: 141px; top: 16px; bottom: -10px; width: 1.5px; background: #D8DFFB;
}
.pd-tl-group { display: grid; grid-template-columns: 112px 60px minmax(0, 1fr); align-items: start; }
.pd-tl-group + .pd-tl-group { margin-top: 14px; }
.pd-tl-when { padding-top: 4px; }
.pd-tl-when strong { display: block; font-size: 14.5px; line-height: 21px; font-weight: 700; color: var(--pd-ink); }
.pd-tl-when span { display: block; margin-top: 2px; font-size: 13.5px; line-height: 20px; color: var(--pd-ink-3); }
.pd-tl-dot {
  position: relative; z-index: 1; justify-self: center; margin-top: 12px; width: 11px; height: 11px;
  border-radius: 50%; border: 2.5px solid var(--pd-blue); background: #fff; box-shadow: 0 0 0 3px #fff;
}

.pd-tl-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pd-tl-event {
  background: #fff; border: 1px solid var(--pd-line); border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pd-tl-event:hover, .pd-tl-event.is-open { border-color: #CBD3FF; }
.pd-tl-event.is-open { box-shadow: var(--pd-shadow); }
.pd-tl-row {
  display: grid; grid-template-columns: 44px minmax(0, 385px) minmax(0, 1fr) auto; align-items: center; column-gap: 18px;
  min-height: 58px; padding: 6px 15px;
}
.pd-tl-icon {
  width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center;
  background: #F5F7FF; border: 1px solid #DCE2FF; color: var(--pd-blue);
}
.pd-tl-text { min-width: 0; }
.pd-tl-text h3 { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; color: var(--pd-ink); }
.pd-tl-text p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--pd-ink-2); }
.pd-tl-badges { display: flex; flex-wrap: wrap; gap: 8px 13px; }
.pd .pd-tl-toggle { height: 33px; min-width: 78px; padding: 0 14px; border-radius: 7px; font: 500 13.5px var(--pd-font); cursor: pointer; }
.pd .pd-tl-toggle:hover { border-color: var(--pd-blue); }

.pd-tl-evidence { padding: 12px 16px 14px 77px; border-top: 1px solid var(--pd-line-2); }
.pd-tl-evidence > :first-child { margin-top: 0; }
.pd-tl-evidence .pd-inline-diff, .pd-tl-evidence .pd-event-details { margin-left: 0; }
.pd-tl-evidence .pd-event-details { max-width: none; }
.pd-tl-facts { margin: 10px 0 0; display: grid; gap: 6px; font-size: 12.5px; }
.pd-tl-facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.pd-tl-facts dt { color: var(--pd-ink-3); }
.pd-tl-facts dd { margin: 0; color: var(--pd-ink-2); }
.pd-tl-facts code { font-family: var(--pd-mono); font-size: 12px; color: var(--pd-ink); overflow-wrap: anywhere; }
.pd-tl-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 0; }
.pd .pd-tl-links .pd-link { font-size: 13px; }
.pd-history .pd-pager { margin: 22px 0 0; }

/* Compare + evidence */
.pd-model-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 448px; gap: 18px; margin-top: 20px; }
.pd-box-head { display: flex; align-items: flex-start; gap: 10px; }
.pd-box-icon {
  width: 44px; height: 44px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: #F2F4FF; border: 1px solid #DCE2FF; color: var(--pd-blue);
}
.pd-model .pd-box-head h2 { margin: 3px 0 2px; font-size: 15.5px; }
.pd-box-head p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--pd-ink-2); }

.pd-compare { padding: 19px 20px 18px; }
.pd-compare-form {
  display: grid; grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr) 160px; align-items: center; gap: 10px;
  margin-top: 14px;
}
.pd-snap { position: relative; display: block; color: var(--pd-ink); }
.pd-snap select {
  width: 100%; height: 46px; padding: 14px 36px 0 52px; appearance: none; -webkit-appearance: none;
  background: #fff; border: 1px solid #D9E0EC; border-radius: 8px;
  font: 500 14px var(--pd-font); color: var(--pd-ink); cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pd-snap select:hover { border-color: #C3CDE0; }
.pd-snap select:focus { outline: 0; border-color: var(--pd-blue); box-shadow: 0 0 0 4px rgba(59, 69, 255, .12); }
.pd-snap select:disabled { color: var(--pd-ink-3); cursor: not-allowed; }
.pd-snap-label { position: absolute; left: 53px; top: 6px; font-size: 11.5px; line-height: 14px; color: var(--pd-ink-2); pointer-events: none; }
.pd-snap-cal, .pd-snap-chev { position: absolute; top: 50%; transform: translateY(-50%); pointer-events: none; }
.pd-snap-cal { left: 17px; color: var(--pd-ink); }
.pd-snap-chev { right: 14px; }
.pd-compare-swap { display: grid; place-items: center; color: var(--pd-ink-2); }
.pd .pd-compare-btn { width: 100%; height: 46px; font-size: 14.5px; font-weight: 500; }
.pd .pd-compare-btn:disabled { filter: grayscale(.6); opacity: .6; cursor: not-allowed; }

.pd-evidence { padding: 19px 18px 18px; display: flex; flex-direction: column; }
.pd .pd-evidence-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 33px; margin-top: auto;
  background: #F2F4FF; border: 1px solid #DCE2FF; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--pd-blue);
  transition: background-color .15s ease, border-color .15s ease;
}
.pd-box-head + .pd-evidence-btn { margin-top: 14px; }
.pd a.pd-evidence-btn:hover { background: #E8ECFF; border-color: #C9D2FF; }
.pd .pd-evidence-btn.is-disabled { color: var(--pd-ink-3); background: #FAFBFD; border-color: var(--pd-line); }

/* Not found / error */
.pd-model-state { margin-top: 30px; }
.pd-model-state h1 { margin: 16px 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.pd-model-state code { font-family: var(--pd-mono); font-size: 13px; color: var(--pd-ink); }
.pd-model-state-search { display: flex; gap: 10px; width: 100%; max-width: 520px; margin: 0 0 18px; }
.pd-model-state-search .pd-search-field { height: 44px; }

/* Responsive */
@media (max-width: 1200px) {
  .pd-model-top { grid-template-columns: minmax(0, 1fr) 340px; }
  .pd-model-bottom { grid-template-columns: minmax(0, 1fr) 380px; }
  .pd-status-rows > div { grid-template-columns: 200px minmax(0, 1fr); }
  .pd-tl-row { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
  .pd-compare-form { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); }
  .pd-compare-btn { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .pd-model-top, .pd-model-bottom { grid-template-columns: minmax(0, 1fr); }
  .pd-actions ul { grid-template-columns: 1fr 1fr; }
  .pd-history > .pd-card-head { flex-wrap: wrap; }
  .pd-history-filters { flex: 1 1 100%; }
  .pd-history .pd-select, .pd-history .pd-select:nth-child(2) { flex: 1 1 0; }
  .pd-tl-row { grid-template-columns: 44px minmax(0, 1fr) auto; row-gap: 8px; padding: 10px 15px; }
  .pd-tl-badges { grid-column: 2; grid-row: 2; }
  .pd-tl-toggle { grid-column: 3; grid-row: 1 / span 2; }
}

@media (max-width: 760px) {
  .pd-model-head { gap: 14px; margin-top: 18px; }
  .pd-model-avatar { width: 56px; height: 56px; font-size: 22px; }
  .pd-model-avatar img { padding: 9px; }
  .pd-model-id { padding-top: 0; }
  .pd-model-id h1 { font-size: 24px; gap: 4px 10px; }
  .pd-model-sub { font-size: 14.5px; }
  .pd-model-meta { gap: 8px 16px; }
  .pd-model-meta li.pd-model-stat:not(.pd-model-stat + .pd-model-stat) { padding-left: 0; border-left: 0; }
  .pd-tabs { gap: 18px; margin: 18px -16px 0; padding: 0 16px; }
  .pd-status, .pd-actions, .pd-history, .pd-compare, .pd-evidence { padding: 16px; }
  .pd-card-head { flex-wrap: wrap; gap: 6px 16px; }
  .pd-status-rows > div { grid-template-columns: 124px minmax(0, 1fr); padding: 6px 0; }
  .pd-actions ul { grid-template-columns: 1fr; }
  .pd-history-filters { flex-wrap: wrap; }
  .pd-history .pd-select, .pd-history .pd-select:nth-child(2) { flex: 1 1 calc(50% - 5px); }
  .pd-timeline::before { left: 10px; top: 8px; bottom: 0; }
  .pd-tl-group { grid-template-columns: 22px minmax(0, 1fr); }
  .pd-tl-when { grid-column: 2; grid-row: 1; display: flex; align-items: baseline; gap: 8px; padding: 0 0 8px 8px; }
  .pd-tl-when span { margin: 0; }
  .pd-tl-dot { grid-column: 1; grid-row: 1; margin-top: 5px; }
  .pd-tl-events { grid-column: 2; padding-left: 8px; }
  .pd-tl-row { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; padding: 12px; }
  .pd-tl-icon { width: 40px; height: 40px; }
  .pd-tl-badges { grid-column: 1 / -1; grid-row: auto; }
  .pd-tl-toggle { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .pd-tl-evidence { padding: 12px; }
  .pd-tl-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .pd-compare-form { grid-template-columns: minmax(0, 1fr); }
  .pd-compare-swap { transform: rotate(90deg); height: 20px; }
  .pd-model-state-search { flex-direction: column; }
}

/* Add dependency from the model page */
.pd-action-add > summary { list-style: none; cursor: pointer; }
.pd-action-add > summary::-webkit-details-marker { display: none; }
.pd-action-form { display: grid; gap: 6px; margin: 10px 2px 4px; }
.pd-action-form label { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--pd-ink); }
.pd .pd-action-form > input, .pd .pd-action-form select, .pd .pd-action-form [data-new-project] input {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid #D5DCE8; border-radius: var(--pd-radius-sm);
  background: #fff; font: 400 13.5px var(--pd-font); color: var(--pd-ink);
}
.pd-action-form [data-new-project] { display: grid; gap: 6px; }
.pd-action-form [data-new-project][hidden] { display: none; }
.pd-action-form .pd-btn { justify-self: start; margin-top: 10px; }
.pd-action-form .pd-revq { margin-top: 6px; }
