/* ==========================================================================
   phase7-thischat.css — owner UX round (This chat sheet & Top bar target)
   Target: iPhone 13 Pro Max Safari / WebKit + desktop, dark + light themes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Top bar: single unified tap/hold target (§Phase 7)
   Filling the full header height between left/right edge buttons.
   Press feedback (scale/opacity) while holding, no text selection, no callout.
   -------------------------------------------------------------------------- */
#btn-title {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transition: transform 120ms ease, opacity 120ms ease;
}

#btn-title.is-holding {
  transform: scale(0.97);
  opacity: 0.72;
}

/* Ensure title row and subtitle behave as one unified target */
#btn-title .htitle-top-row {
  pointer-events: none;
}

#btn-title .sess-sub-cwd {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   2. This chat sheet layout & header
   -------------------------------------------------------------------------- */
.thischat-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.thischat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.thischat-title-box {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thischat-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.thischat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
  white-space: normal;
}

.thischat-folder-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  color: var(--ink-2);
}

.thischat-folder-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 250px;
}

/* Reusable icon buttons with ≥44px touch targets */
.thischat-icon-btn,
.thischat-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.thischat-icon-btn:active,
.thischat-close-btn:active {
  background: var(--surface-2);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   3. Ospi Card look inside This chat sheet
   -------------------------------------------------------------------------- */
.thischat-sheet .ospi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-sizing: border-box;
}

.thischat-sheet .ospi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  text-align: left;
}

.thischat-sheet .ospi-row[hidden] {
  display: none !important;
}

.thischat-sheet .ospi-row:last-child {
  border-bottom: 0;
}

.thischat-sheet .ospi-row-btn {
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.thischat-sheet .ospi-row-btn:active {
  background: var(--surface-2);
  border-radius: 8px;
}

.thischat-sheet .ospi-k {
  color: var(--ink-2);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.thischat-sheet .ospi-v {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  color: var(--ink);
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.thischat-sheet .ospi-chev {
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1;
}

.thischat-sheet .ospi-primary {
  color: var(--accent);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   4. Model card
   -------------------------------------------------------------------------- */
.thischat-model-card {
  padding: 2px 14px !important;
}

.thischat-model-btn {
  padding: 10px 0 !important;
}

.thischat-model-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.thischat-model-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thischat-model-think {
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   5. Context card & Ring
   -------------------------------------------------------------------------- */
.thischat-sheet .ospi-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--line);
}

.thischat-sheet .ospi-chat-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.thischat-sheet .ospi-chat-id b {
  font-size: 14.5px;
  color: var(--ink);
}

.thischat-sheet .ospi-ctxring {
  --p: 0%;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--p), var(--surface-2) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thischat-sheet .ospi-ctxring b {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   6. Session card & mini copy button
   -------------------------------------------------------------------------- */
.thischat-file-val {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 70%;
}

.thischat-file-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thischat-mini-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 4px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
}

.thischat-mini-copy:active {
  background: var(--surface-2);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   7. Compact model card ring, Links & files, folded Details (2026-10-15)
   -------------------------------------------------------------------------- */
.thischat-sheet .thischat-ring {
  width: 30px;
  height: 30px;
  margin-left: auto;
}

.thischat-sheet .thischat-ring b {
  width: 23px;
  height: 23px;
  font-size: 8.5px;
}

.thischat-sheet .thischat-ring[hidden] {
  display: none;
}

.thischat-links-card {
  padding: 10px 6px 6px 14px !important;
}

.thischat-links-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 8px 6px 0;
  font-size: 14.5px;
  color: var(--ink);
}

.thischat-links-list {
  display: flex;
  flex-direction: column;
}

.thischat-links-empty {
  padding: 8px 8px 10px 0;
  font-size: 13px;
  color: var(--ink-2);
}

.thischat-link {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line);
}

.thischat-link-open {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.thischat-link-open:active {
  background: var(--surface-2);
  border-radius: 8px;
}

.thischat-link-ic {
  flex: none;
  margin-top: 1px;
  color: var(--ink-2);
}

.thischat-link-txt {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.thischat-link-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.thischat-link-meta {
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thischat-links-more {
  appearance: none;
  -webkit-appearance: none;
  margin: 2px 8px 4px 0;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.thischat-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 4px;
  font-size: 13px;
  color: var(--ink-2);
}

.thischat-details > summary::-webkit-details-marker {
  display: none;
}

.thischat-details > summary::before {
  content: '›';
  display: inline-block;
  width: 14px;
  transition: transform 120ms ease;
}

.thischat-details[open] > summary::before {
  transform: rotate(90deg);
}

/* Divider sits on Compact, so a hidden Compact leaves no stray line. */
.thischat-sheet .thischat-model-btn {
  border-bottom: 0;
}

.thischat-sheet .thischat-compact-btn {
  border-top: 1px solid var(--line);
}

/* Review link whose folder was swept (lib-chat-links.js pageInfo). */
.thischat-link.is-gone { opacity: .55; }
