/* =============================================================
   PR425 — PlanHub CSS
   Mobile-first, desktop-adaptive. TradeRail brand colors.
   ============================================================= */

/* ── Root container ── */
#ph-root {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #0e0e12;
  color: #f0f0f4;
  font-family: 'Barlow', sans-serif;
  padding-bottom: 80px;
}
#ph-root.ph-night {
  filter: invert(1) hue-rotate(180deg);
}

/* ── Header ── */
.ph-header {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid rgba(255,107,0,0.2);
  background: #141310;
}
.ph-header-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ph-logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FF6B00;
  display: inline-block;
}
.ph-header-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

/* ── Changelog banner ── */
.ph-changelog {
  background: rgba(255,107,0,0.08);
  border-left: 3px solid #FF6B00;
  margin: 0.75rem 1rem;
  border-radius: 8px;
  overflow: hidden;
}
.ph-changelog-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.ph-changelog-icon { font-size: 14px; }
.ph-changelog-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #FF6B00;
}
.ph-changelog-tog {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.ph-changelog-detail { padding: 0 12px 10px; }
.ph-changelog-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}
.ph-changelog-row:last-child { border-bottom: none; }
.ph-changelog-num  { font-size: 12px; font-weight: 700; color: #fff; min-width: 48px; }
.ph-changelog-ttl  { font-size: 12px; color: rgba(255,255,255,0.7); flex: 1; }
.ph-changelog-rev  { font-size: 11px; color: rgba(255,107,0,0.8); }
.ph-changelog-cmp  {
  font-size: 11px;
  background: none;
  border: 1px solid rgba(255,107,0,0.4);
  color: #FF6B00;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
}

/* ── Discipline chips ── */
.ph-disc-chips {
  display: flex;
  gap: 8px;
  padding: 10px 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: #141310;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ph-disc-chips::-webkit-scrollbar { display: none; }
.ph-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ph-chip:hover { border-color: rgba(255,107,0,0.5); color: #fff; }
.ph-chip-active {
  background: rgba(255,107,0,0.15);
  border-color: #FF6B00;
  color: #FF6B00;
}
.ph-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Toolbar ── */
.ph-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 1rem;
  background: #1a1a22;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.ph-search-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 160px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 0 10px;
  gap: 6px;
}
.ph-search-ic { font-size: 13px; opacity: 0.5; }
.ph-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  padding: 7px 0;
}
.ph-search-input::placeholder { color: rgba(255,255,255,0.3); }
.ph-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ph-set-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ph-set-label { font-size: 11px; color: rgba(255,255,255,0.45); }
.ph-set-sel, .ph-sort-sel {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  padding: 5px 8px;
  cursor: pointer;
}
.ph-view-btn {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.ph-view-active {
  background: rgba(255,107,0,0.15);
  border-color: #FF6B00;
  color: #FF6B00;
}
.ph-sel-btn {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
}
.ph-sel-active { background: rgba(255,107,0,0.15); border-color: #FF6B00; color: #FF6B00; }
.ph-night-btn {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
}
.ph-night-active { color: #FF6B00; border-color: #FF6B00; }

/* ── Multi-select action bar ── */
.ph-multibar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 1rem;
  background: rgba(255,107,0,0.12);
  border-bottom: 1px solid rgba(255,107,0,0.3);
  flex-wrap: wrap;
}
.ph-multibar-count { font-size: 13px; font-weight: 700; color: #FF6B00; flex: 1; }
.ph-multibar-btn {
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
}
.ph-multibar-dl  { background: #2E9E6B; color: #fff; }
.ph-multibar-exp { background: #4A90D9; color: #fff; }
.ph-multibar-prt { background: #7B5EA7; color: #fff; }
.ph-multibar-clr { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }

/* ── Disc dot ── */
.ph-disc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.ph-disc-dot-sm { width: 7px; height: 7px; }

/* ── Sheet grid ── */
.ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 1rem;
}
@media (min-width: 768px) {
  .ph-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 1200px) {
  #ph-root { flex-direction: row; flex-wrap: wrap; }
  .ph-disc-chips, .ph-toolbar, .ph-multibar, .ph-changelog, .ph-header, .ph-grid, .ph-list, .ph-footer, .ph-empty {
    width: 100%;
  }
}

/* ── Sheet card ── */
.ph-card {
  background: #1e1e28;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}
.ph-card:hover { transform: translateY(-2px); border-color: rgba(255,107,0,0.4); }
.ph-card-fav { border-color: rgba(255,107,0,0.5); }
.ph-card-new { border-color: rgba(46,158,107,0.5); }
.ph-card-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: #111;
  overflow: hidden;
}
.ph-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.ph-card:hover .ph-card-thumb img { transform: scale(1.03); }
.ph-card-badges {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ph-card-chk {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  z-index: 2;
  cursor: pointer;
}
.ph-card-info {
  padding: 8px 10px 10px;
}
.ph-card-num-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ph-card-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex: 1;
}
.ph-card-title {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ph-card-actions {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}
.ph-card-act-btn {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.ph-card-act-btn:hover { border-color: #FF6B00; color: #FF6B00; }

/* ── Favorites star ── */
.ph-star {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  color: rgba(255,255,255,0.3);
  padding: 0 2px;
  line-height: 1;
}
.ph-star-on  { color: #FF6B00; }
.ph-star-sm  { font-size: 13px; }

/* ── Badges ── */
.ph-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.ph-badge-new   { background: #2E9E6B; color: #fff; }
.ph-badge-rev   { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); }
.ph-badge-cur   { background: rgba(46,158,107,0.2); color: #2E9E6B; border: 1px solid #2E9E6B; }
.ph-badge-super { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); }
.ph-badge-rfi   { background: rgba(232,160,32,0.2); color: #E8A020; }
.ph-badge-punch { background: rgba(217,74,74,0.2); color: #D94A4A; }
.ph-badge-photo { background: rgba(255,107,0,0.2); color: #FF6B00; }
.ph-badge-inline { margin-left: 5px; }

/* ── List view ── */
.ph-list { padding: 0.5rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.ph-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1e1e28;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer;
  transition: background 0.1s;
}
.ph-list-row:hover { background: #252530; }
.ph-row-fav { border-color: rgba(255,107,0,0.3); }
.ph-row-chk { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.ph-row-num { font-family:'Barlow Condensed',sans-serif; font-size:13px; font-weight:700; color:#fff; min-width:52px; }
.ph-row-title { flex:1; font-size:12px; color:rgba(255,255,255,0.7); }
.ph-row-disc { font-size:11px; font-weight:600; min-width:90px; }
.ph-row-rev { font-size:11px; color:rgba(255,255,255,0.45); min-width:48px; display:flex; align-items:center; gap:4px; }

/* ── Empty state ── */
.ph-empty { text-align:center; padding:4rem 2rem; }
.ph-empty-icon { font-size:40px; opacity:0.3; margin-bottom:1rem; }
.ph-empty-msg { font-size:14px; color:rgba(255,255,255,0.4); }

/* ── Footer ── */
.ph-footer {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  padding: 1rem;
}

/* ================================================================
   FULL-SCREEN VIEWER OVERLAY
   ================================================================ */
#ph-viewer-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 3000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
body.ph-viewer-open { overflow: hidden; }

.ph-viewer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #141310;
  border-bottom: 1px solid rgba(255,107,0,0.25);
  flex-shrink: 0;
  z-index: 10;
}
.ph-viewer-back {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.ph-viewer-back:hover { background: rgba(255,255,255,0.1); }
.ph-viewer-title-wrap { flex: 1; min-width: 0; }
.ph-viewer-sheet-num {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.ph-viewer-sheet-title {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ph-viewer-top-right { display: flex; gap: 6px; flex-shrink: 0; }
.ph-viewer-icon-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  padding: 5px 9px;
  cursor: pointer;
}
.ph-viewer-icon-btn:hover { background: rgba(255,107,0,0.2); border-color: #FF6B00; }

/* Sheet counter */
.ph-viewer-counter {
  position: absolute;
  top: 56px;
  right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 3px 9px;
  z-index: 5;
}

/* Image area */
.ph-viewer-img-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  touch-action: none;
}
.ph-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.ph-viewer-night .ph-viewer-img { filter: invert(1); }

/* Superseded watermark */
.ph-superseded-wm {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(217,74,74,0.12);
  border: 4px solid rgba(217,74,74,0.4);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(24px, 6vw, 60px);
  font-weight: 900;
  color: rgba(217,74,74,0.6);
  letter-spacing: 4px;
  pointer-events: none;
  z-index: 3;
  transform: rotate(-15deg);
}

/* Nav arrows */
.ph-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 28px;
  width: 40px;
  height: 60px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph-nav-prev { left: 8px; }
.ph-nav-next { right: 8px; }
.ph-nav-btn:hover { background: rgba(255,107,0,0.3); border-color: #FF6B00; }

/* Version pill */
.ph-version-pill {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,19,16,0.85);
  border: 1px solid rgba(255,107,0,0.4);
  border-radius: 20px;
  padding: 6px 16px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.ph-version-pill-text { font-size: 12px; color: rgba(255,255,255,0.8); white-space: nowrap; }

/* Bottom action bar */
.ph-viewer-bottom {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #141310;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ph-viewer-bottom::-webkit-scrollbar { display: none; }
.ph-bottom-btn {
  font-size: 12px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.ph-bottom-btn:hover { border-color: #FF6B00; color: #FF6B00; }
.ph-bottom-btn-cmp { border-color: rgba(74,144,217,0.5); color: #4A90D9; }

/* ── Version tray ── */
.ph-vtray {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a1a22;
  border-top: 2px solid #FF6B00;
  border-radius: 16px 16px 0 0;
  max-height: 60vh;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  z-index: 20;
  overflow: hidden;
}
.ph-vtray-open { transform: translateY(0); }
.ph-vtray-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ph-vtray-title { flex: 1; font-size: 13px; font-weight: 700; color: #fff; }
.ph-vtray-close { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 20px; cursor: pointer; }
.ph-vtray-scroll {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ph-vtray-scroll::-webkit-scrollbar { display: none; }
.ph-vcard {
  flex-shrink: 0;
  width: 140px;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.ph-vcard-current { background: rgba(46,158,107,0.12); border-color: #2E9E6B; }
.ph-vcard-super   { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.ph-vcard:hover   { border-color: #FF6B00; }
.ph-vcard-badge {
  font-size: 9px;
  font-weight: 900;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ph-vcard-current .ph-vcard-badge { color: #2E9E6B; }
.ph-vcard-super   .ph-vcard-badge { color: rgba(255,255,255,0.35); }
.ph-vcard-rev  { font-size: 14px; font-weight: 700; color: #fff; }
.ph-vcard-set  { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 3px; }
.ph-vcard-date { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 2px; }
.ph-vcard-cmp  {
  margin-top: 8px;
  font-size: 11px;
  background: none;
  border: 1px solid rgba(74,144,217,0.5);
  color: #4A90D9;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  width: 100%;
}

/* ── Pin layer menu ── */
.ph-pin-menu {
  position: absolute;
  top: 52px;
  right: 12px;
  background: #1e1e28;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 10px 14px;
  z-index: 20;
  display: none;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ph-pin-menu-open { display: block; }
.ph-pin-menu-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.ph-pin-menu-lbl { font-size: 13px; color: rgba(255,255,255,0.8); cursor: pointer; }

/* ── Export menu ── */
.ph-export-menu {
  position: absolute;
  top: 52px;
  right: 12px;
  background: #1e1e28;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 6px;
  z-index: 20;
  display: none;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ph-export-menu-open { display: block; }
.ph-export-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.ph-export-opt:hover { background: rgba(255,107,0,0.12); color: #FF6B00; }

/* ── Compare overlay ── */
.ph-compare-overlay {
  position: absolute;
  inset: 0;
  background: #0a0a0f;
  z-index: 30;
  flex-direction: column;
  overflow: auto;
}
.ph-cmp-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #141310;
  border-bottom: 1px solid rgba(255,107,0,0.3);
}
.ph-cmp-title { flex: 1; font-size: 14px; font-weight: 700; color: #fff; }
.ph-cmp-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.ph-cmp-legend {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.03);
}
.ph-cmp-added   { color: #4A90D9; }
.ph-cmp-removed { color: #D94A4A; }
.ph-cmp-wrap {
  display: flex;
  gap: 8px;
  padding: 12px;
  flex-wrap: wrap;
}
.ph-cmp-side { flex: 1; min-width: 280px; }
.ph-cmp-side-label {
  font-size: 11px;
  font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.ph-cmp-cur-label  { background: rgba(46,158,107,0.2); color: #2E9E6B; }
.ph-cmp-prev-label { background: rgba(217,74,74,0.2); color: #D94A4A; }
.ph-cmp-img { width: 100%; display: block; border-radius: 8px; }
.ph-cmp-prev-wrap { position: relative; }
.ph-cmp-diff-overlay {
  position: absolute;
  inset: 0;
  background: rgba(74,144,217,0.25);
  border-radius: 8px;
  opacity: 0.3;
  pointer-events: none;
  mix-blend-mode: screen;
}
.ph-cmp-slider-wrap { padding: 12px 16px; }
.ph-cmp-slider-label { font-size: 12px; color: rgba(255,255,255,0.6); display: block; margin-bottom: 6px; }
.ph-cmp-slider { width: 100%; accent-color: #FF6B00; }

/* ── Pins ── */
.ph-pin-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.ph-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  pointer-events: all;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform 0.15s;
  z-index: 5;
}
.ph-pin:hover { transform: translate(-50%, -50%) scale(1.25); }

/* ── Pin popup ── */
.ph-pin-popup {
  position: fixed;
  background: #1e1e28;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0;
  min-width: 220px;
  max-width: 300px;
  z-index: 4000;
  box-shadow: 0 12px 32px rgba(0,0,0,0.7);
  overflow: hidden;
}
.ph-pin-popup-head {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
}
.ph-pin-popup-label { flex: 1; font-size: 13px; font-weight: 700; color: #fff; }
.ph-pin-popup-close { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 18px; cursor: pointer; }
.ph-pin-popup-note { font-size: 13px; color: rgba(255,255,255,0.8); padding: 10px 12px; }
.ph-pin-popup-meta { font-size: 11px; color: rgba(255,255,255,0.4); padding: 0 12px 8px; }
.ph-pin-popup-photo { font-size: 12px; color: rgba(255,107,0,0.8); padding: 0 12px 8px; }
.ph-pin-popup-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px 10px;
  padding: 8px;
  background: rgba(255,107,0,0.15);
  border: 1px solid rgba(255,107,0,0.4);
  color: #FF6B00;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  text-align: center;
}

/* ── Pin drop prompt ── */
.ph-pin-prompt {
  position: fixed;
  background: #1e1e28;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px;
  min-width: 170px;
  z-index: 4000;
  box-shadow: 0 12px 32px rgba(0,0,0,0.7);
}
.ph-pin-prompt-title { font-size: 11px; color: rgba(255,255,255,0.45); margin-bottom: 8px; }
.ph-pin-prompt-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  color: #fff;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  margin-bottom: 5px;
}
.ph-pin-prompt-btn:hover { background: rgba(255,107,0,0.12); }
.ph-pin-prompt-cancel {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  cursor: pointer;
  margin-top: 4px;
  padding: 4px;
  font-family: 'Barlow', sans-serif;
}

/* ── Desktop split layout ── */
@media (min-width: 1024px) {
  #ph-root {
    display: grid;
    grid-template-rows: auto auto auto auto 1fr auto;
    grid-template-columns: 260px 1fr;
  }
  .ph-header     { grid-column: 1 / -1; }
  .ph-changelog  { grid-column: 1 / -1; }
  .ph-disc-chips { grid-column: 1 / -1; }
  .ph-toolbar    { grid-column: 1 / -1; }
  .ph-multibar   { grid-column: 1 / -1; }
  .ph-grid, .ph-list, .ph-empty { grid-column: 1 / -1; }
  .ph-footer     { grid-column: 1 / -1; }
  .ph-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 1.25rem 1.5rem;
  }
  /* Viewer: side panel on very large screens */
  #ph-viewer-overlay {
    left: 260px; /* offset for sidebar */
  }
}

/* ── Landscape orientation — full-screen viewer ── */
@media (orientation: landscape) and (max-height: 500px) {
  /* When viewer is open and phone is sideways, maximise canvas area */
  body.ph-viewer-open #ph-viewer-overlay {
    /* overlay already covers full viewport via position:fixed inset:0 */
    /* just ensure nothing clips it on the sides */
  }

  /* Collapse the top bar to bare minimum height */
  .ph-viewer-top {
    padding: 4px 10px;
    min-height: 0;
  }
  .ph-viewer-sheet-title {
    display: none; /* hide subtitle in landscape — saves vertical real-estate */
  }
  .ph-viewer-sheet-num {
    font-size: 13px;
  }

  /* Hide version pill — too cluttered in landscape */
  .ph-version-pill {
    display: none !important;
  }

  /* Shrink bottom action bar */
  .ph-viewer-bottom {
    padding: 5px 10px;
    gap: 6px;
  }
  .ph-bottom-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* Give image area maximum height */
  .ph-viewer-img-wrap {
    flex: 1;
  }

  /* Sheet counter — reposition so it doesn't overlap top bar */
  .ph-viewer-counter {
    top: 40px;
    right: 8px;
  }

  /* Nav arrows — keep visible but slightly smaller */
  .ph-nav-btn {
    width: 32px;
    height: 50px;
    font-size: 22px;
  }

  /* Version tray max height reduced in landscape */
  .ph-vtray {
    max-height: 75vh;
  }

  /* Hide sheet subtitle in viewer title wrap */
  .ph-viewer-title-wrap .ph-viewer-sheet-title {
    display: none;
  }

  /* L5: Sidebar rail in landscape — use class-toggle so JS can still override.
     The viewer's open() adds ph-viewer-open to body; use that as scope instead of !important. */
  body.ph-viewer-open .pui1b-rail {
    display: none;
  }
}
