/* Item page (#/item/ID): header, content, script or caption, activity. Every class starts with item-. */
.item-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; padding-top: 4px; }
.item-page [hidden] { display: none !important; }
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.item-pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- header ---------- */
.item-head { display: flex; flex-direction: column; gap: 12px; }
.item-back { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; margin: -6px 0; }
.item-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.item-serial { width: 44px; height: 44px; font-size: 18px; background: var(--surface); border: 1px solid var(--line); }
.item-title { min-width: 0; font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }

/* ---------- script ---------- */
.item-script { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.item-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.item-script-text { font-size: 15px; line-height: 1.6; }
.item-note { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; font-size: 14px; }
.item-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line); }
.item-actions-main, .item-actions-quiet { display: flex; flex-wrap: wrap; gap: 10px; }
.item-actions-quiet { gap: 4px; margin-left: auto; }
.item-actions-quiet .btn { color: var(--muted); }
.item-actions-quiet .item-delete:hover { background: var(--rej-bg); color: var(--rej-fg); }
.item-later { padding: 2px 4px; }

/* ---------- content versions ---------- */
.item-section { display: flex; flex-direction: column; gap: 14px; }
.item-section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
.item-versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.item-none { padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); text-align: center; color: var(--muted); }
.item-version { min-width: 0; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.item-version-picked { padding: 11px; border: 2px solid var(--accent); }
.item-version-quiet { background: var(--off); }
.item-version-quiet .item-preview { opacity: 0.72; transition: opacity 0.15s ease; }
.item-version-quiet:hover .item-preview, .item-version-quiet:focus-within .item-preview { opacity: 1; }
.item-version-text { display: flex; flex-direction: column; gap: 2px; margin-bottom: auto; }
.item-version-name { font-size: 15px; font-weight: 600; }
.item-version-by { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item-version-delete { color: var(--muted); }
.item-version-delete:hover { background: var(--rej-bg); color: var(--rej-fg); }
.item-picked { height: 44px; border-radius: var(--r); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; background: var(--accent); color: var(--on-accent); }

.item-preview { height: 250px; border-radius: var(--r); overflow: hidden; }
.item-preview-media { display: block; background: var(--ink); }
.item-media { display: block; width: 100%; height: 100%; object-fit: contain; }
.item-preview-link { padding: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: var(--bg); border: 1px dashed var(--line-strong); }
.item-link-host { max-width: 100%; font-weight: 600; overflow-wrap: anywhere; }
.item-open { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }

/* add a version */
.item-add { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.item-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.item-choice { display: inline-flex; align-items: center; gap: 8px; }
.item-choice:disabled { opacity: 0.55; cursor: default; }
.item-file { position: relative; min-height: 76px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--off); display: flex; align-items: center; gap: 14px; cursor: pointer; color: var(--accent-ink); }
.item-file:hover { background: var(--soft); }
.item-file:focus-within { outline: 3px solid rgba(11, 122, 85, 0.35); outline-offset: 2px; }
.item-file-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-file-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.item-file-hint, .item-hint { font-size: 13px; font-weight: 400; }
.item-progress { display: flex; flex-direction: column; gap: 6px; }
.item-progress-track { height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.item-progress-bar { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.15s linear; }
.item-progress-text { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.item-add-foot { display: flex; justify-content: flex-end; }

/* the bar under the versions: send, ask for new ones, mark uploaded */
.item-bar { padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.item-bar-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.item-bar-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.item-calm { justify-content: flex-start; gap: 10px; color: var(--muted); }

/* ---------- activity ---------- */
.item-activity { min-width: 0; padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.item-acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.item-act { display: flex; gap: 12px; }
.item-act .avatar { width: 30px; height: 30px; font-size: 12px; }
.item-act-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; overflow-wrap: anywhere; }
.item-act-body .note { font-size: 14px; }
.item-act-time { font-size: 12px; color: var(--muted); }
.item-comment { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.item-comment label { font-weight: 600; }
.item-comment .textarea { font-size: 14px; line-height: 1.5; padding: 10px 12px; }
.item-comment .btn { align-self: flex-end; }

.item-missing { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.item-missing .h2 { color: var(--ink); }
.item-missing .btn { margin-top: 6px; }

/* Two columns once there is room for the activity panel next to the content. */
@media (min-width: 1180px) {
  .item-page { grid-template-columns: minmax(0, 1fr) 348px; gap: 28px; }
}

/* Phone */
@media (max-width: 860px) {
  .item-page, .item-main { gap: 16px; }
  .item-title { font-size: 22px; }
  .item-serial { width: 38px; height: 38px; font-size: 16px; }
  .item-script { padding: 16px; }
  .item-activity { padding: 16px; }
  .item-add { padding: 16px; }
  .item-actions-main { flex: 1 1 100%; }
  .item-actions-main .btn { flex: 1 1 auto; }
  .item-choice { flex: 1 1 0; justify-content: center; padding: 0 10px; }
  .item-add-foot .btn, .item-bar > .btn, .item-bar-buttons, .item-bar-buttons .btn { flex: 1 1 100%; }
  .item-preview { height: 220px; }
}
