
.product-development-screen,
.product-development-detail-screen {
  width: min(100%, 1280px);
  display: none;
}

.product-development-screen:target,
.product-development-detail-screen:target {
  display: block;
}

body:has(.product-development-screen:target) .dashboard,
body:has(.product-development-detail-screen:target) .dashboard {
  display: none;
}

#product-development.product-development-active-fallback {
  display: block;
}

body:has(#product-development.product-development-active-fallback) .dashboard {
  display: none;
}

.pd-topbar,
.pd-detail-head,
.pd-actions,
.pd-filters,
.pd-markup-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pd-topbar,
.pd-detail-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.pd-topbar .customer-actions {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
}

.pd-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(120px, 1fr));
  margin-bottom: 10px;
}

.pd-filters input,
.pd-filters select,
.pd-project-form input,
.pd-project-form select,
.pd-project-form textarea,
.pd-project-form .ts-control,
.pd-version-form input,
.pd-version-form select,
.pd-version-form textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid #9fb9c5;
  border-radius: 4px;
  background: #ffffff;
  padding: 6px 8px;
  color: #111827;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.pd-project-form .ts-wrapper {
  width: 100%;
}

.pd-project-form .ts-control {
  min-height: 32px;
}

.pd-project-form .ts-control input {
  border: 0;
  box-shadow: none;
  min-height: 20px;
  padding: 0;
}

.pd-filters input:focus,
.pd-filters select:focus,
.pd-project-form input:focus,
.pd-project-form select:focus,
.pd-project-form textarea:focus,
.pd-project-form .ts-wrapper.focus .ts-control,
.pd-version-form input:focus,
.pd-version-form select:focus,
.pd-version-form textarea:focus {
  border-color: #17436c;
  outline: 2px solid rgba(23, 67, 108, 0.18);
  outline-offset: 1px;
}

.pd-panel {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}

.pd-grid-wrap {
  max-height: 280px;
  overflow: auto;
}

.pd-table {
  min-width: 1120px;
}

.pd-table th,
.pd-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.pd-project-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 6px 8px;
  margin-bottom: 12px;
}

.pd-project-form label,
.pd-version-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pd-wide {
  grid-column: span 2;
}

.pd-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 10px;
}

.pd-pages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pd-toptabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.pd-toptab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

.pd-toptab:hover { color: var(--text, inherit); }

.pd-toptab.is-active {
  color: var(--text, inherit);
  background: var(--card, #fff);
  border-color: var(--border);
  margin-bottom: -1px;
}

.pd-ts-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.pd-ts-groups {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-ts-groups-head { font-weight: 800; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.pd-ts-add { display: flex; gap: 6px; }

.pd-ts-add select { flex: 1; min-width: 0; }

.pd-ts-add .ts-wrapper { flex: 1; min-width: 0; }

.pd-ts-group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.pd-ts-group-item {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pd-ts-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pd-ts-group-item:hover { border-color: var(--accent, #2563eb); }

.pd-ts-group-item.is-active { background: var(--accent, #2563eb); color: #fff; border-color: var(--accent, #2563eb); }

.pd-ts-group-del {
  appearance: none; border: none; background: transparent; color: inherit;
  opacity: .55; font-size: 16px; font-weight: 800; line-height: 1;
  cursor: pointer; padding: 0 2px; flex: 0 0 auto;
}

.pd-ts-group-del:hover { opacity: 1; color: #dc2626; }

.pd-ts-group-item.is-active .pd-ts-group-del:hover { color: #fff; }

.pd-ts-group-empty,
.pd-ts-empty,
.pd-ts-placeholder { color: var(--muted); font-size: 13px; padding: 10px; }

.pd-ts-main { border: 1px solid var(--border); border-radius: 8px; padding: 12px; min-height: 240px; }

.pd-ts-subtabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }

.pd-ts-subtab {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.pd-ts-subtab.is-active { background: var(--accent, #2563eb); color: #fff; border-color: var(--accent, #2563eb); }

.pd-ts-subtab.is-disabled { opacity: .5; cursor: not-allowed; }

.pd-ts-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px 10px;
}

.pd-ts-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }

.pd-ts-form .pd-ts-wide { grid-column: 1 / -1; }

.pd-ts-table-wrap { overflow-x: auto; margin-bottom: 8px; }

.pd-ts-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.pd-ts-table th,
.pd-ts-table td { border: 1px solid var(--border); padding: 3px 4px; text-align: left; }

.pd-ts-table th { background: var(--card-alt, rgba(0,0,0,.03)); font-weight: 700; color: var(--muted); }

.pd-ts-table input,
.pd-ts-table select { width: 100%; box-sizing: border-box; }

.pd-ts-table input[type="color"] { padding: 0; height: 26px; }

.pd-ts-invalid { outline: 2px solid #dc2626; }

.pd-ts-rowdel {
  appearance: none; border: none; background: transparent; color: #dc2626;
  font-size: 16px; font-weight: 800; cursor: pointer; line-height: 1; padding: 0 4px;
}

.pd-ts-samples-head { margin-bottom: 10px; }

.pd-ts-samples { display: flex; flex-wrap: wrap; gap: 10px; }

.pd-ts-samples-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

.pd-ts-sample {
  position: relative; margin: 0; width: 140px; height: 140px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--card-alt, rgba(0,0,0,.03));
}

.pd-ts-sample img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }

.pd-ts-sample-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  font-size: 15px; font-weight: 800; line-height: 1; cursor: pointer;
}

.pd-ts-sample-del:hover { background: #dc2626; }

.pd-ts-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }

.pd-ts-savehint { color: var(--muted); font-size: 12px; }

.pd-ts-approve-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-alt, rgba(0,0,0,.03));
}

.pd-ts-approve-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }

.pd-ts-approve-stamp { color: var(--muted); font-size: 12px; }

.pd-ts-approved {
  flex: 0 0 auto; color: #16a34a; font-weight: 800; font-size: 13px; line-height: 1;
}

.pd-ts-group-item.is-active .pd-ts-approved { color: #dcfce7; }

.pd-lock-banner {
  margin: 8px 0 12px;
  padding: 8px 12px;
  border: 1px solid #f59e0b;
  background: rgba(245, 158, 11, .12);
  color: var(--text, inherit);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.product-development-detail-screen.pd-locked .pd-project-form input,
.product-development-detail-screen.pd-locked .pd-project-form select,
.product-development-detail-screen.pd-locked .pd-project-form textarea {
  background: var(--card-alt, rgba(0,0,0,.03));
  opacity: .85;
}

@media (max-width: 720px) {
.pd-ts-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
.pd-ts-form { grid-template-columns: 1fr 1fr; }
}

.pd-page-card {
  display: grid;
  grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
  align-items: start;
}

.pd-page-photo canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid #d4dde2;
  border-radius: 4px;
  display: block;
  cursor: zoom-in;
}

.pd-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.pd-zoom-overlay[hidden] {
  display: none;
}

.pd-zoom-overlay canvas {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.pd-zoom-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.pd-zoom-hint {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
  z-index: 1;
}

.pd-page-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border: 1px dashed #b6c6cf;
  border-radius: 4px;
  color: var(--muted);
  background: #f7fafb;
}

.pd-page-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-page-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pd-page-remarks {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pd-page-remarks textarea {
  width: 100%;
  border: 1px solid #9fb9c5;
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
  color: #111827;
}

@media (max-width: 900px) {
.pd-page-card {
    grid-template-columns: 1fr;
  }
}

.pd-item-list {
  border-right: 1px solid var(--border);
  padding-right: 10px;
}

.pd-item-list h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.pd-item-button,
.pd-version-tab {
  width: 100%;
  min-height: 34px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f8fafc;
  color: #20324a;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
}

.pd-item-button.active,
.pd-version-tab.active {
  border-color: #17436c;
  background: #e8f0fb;
  font-weight: 700;
}

.pd-content-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid #c9dbe4;
}

.pd-content-tab {
  min-height: 34px;
  border: 1px solid #9fb9c5;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #f3f8fb;
  color: #20324a;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

.pd-content-tab.active {
  background: #ffffff;
  border-color: #17436c;
  color: #0d344f;
  font-weight: 700;
}

.pd-tab-panel {
  display: none;
}

.pd-tab-panel.active {
  display: block;
}

.pd-drawing-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.pd-drawing-toolbar .small-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pd-tab-hint {
  color: var(--muted);
  font-size: 12px;
}

.pd-drawing-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.pd-drawing-card {
  border: 1px solid #9fb9c5;
  border-radius: 4px;
  padding: 8px;
  background: #fbfcfe;
}

.pd-drawing-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid #c9dbe4;
  border-radius: 4px;
  background: #f3f6fa;
  margin-bottom: 8px;
}

.pd-version-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.pd-version-tab {
  width: auto;
  min-width: 92px;
}

.pd-version-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pd-version-form label:nth-child(n+3) {
  grid-column: span 2;
}

.pd-files,
.pd-comments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.pd-file-card,
.pd-comment-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  background: #fbfcfe;
}

.pd-file-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.pd-file-card img {
  width: 84px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f3f6fa;
}

.pd-file-meta strong,
.pd-comment-card strong {
  display: block;
  color: #1f2f46;
}

.pd-file-meta small,
.pd-comment-card small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.pd-markup-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 24, 32, 0.72);
  display: grid;
  place-items: center;
  padding: 18px;
}

.pd-markup-overlay[hidden] {
  display: none !important;
}

.pd-markup-panel {
  width: min(1100px, 96vw);
  height: min(760px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
  border-radius: 4px;
  border: 1px solid #d7dee8;
}

.pd-markup-toolbar {
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.pd-canvas-wrap {
  overflow: auto;
  display: grid;
  place-items: center;
  background: #eef2f7;
}

#pdMarkupCanvas {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  cursor: crosshair;
}

@media (max-width: 900px) {
.pd-filters,
.pd-project-form,
.pd-version-form,
.pd-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
.pd-wide,
.pd-version-form label:nth-child(n+3) {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
.pd-item-list {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 10px;
  }
}

@media (max-width: 900px) {
.pd-topbar,
.pd-detail-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
.pd-actions {
    flex-wrap: wrap;
  }
}



/* ==========================================================================
   product-development — compact mobile TABLE (module-scoped, <=640px).
   Shows only the most useful columns on phones; other desktop columns are hidden
   VISUALLY (kept in the DOM, still populated, reachable after Open). Desktop
   table unchanged above 640px. Shared compact-table styling for consistency.
   ========================================================================== */
@media (max-width: 640px) {
  #product-development .pd-projects-panel .grid-wrap {
    border-top: 0;
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
  }
  #product-development .pd-projects-panel .grid-wrap > table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
  }
  #product-development .pd-projects-panel .grid-wrap > table > thead {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
  }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th {
    background: #eef2f7;
    color: #213247;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 5px;
    white-space: normal;
    text-align: left;
    vertical-align: middle;
  }
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td {
    display: table-cell;
    padding: 8px 5px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: left;
    vertical-align: middle;
    border: 0;
    border-bottom: 1px solid #e3e8ee;
    max-width: none;
    min-width: 0;
    width: auto;
  }
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td::before { content: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(4),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(4):not([colspan]) { display: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(5),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(5):not([colspan]) { display: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(7),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(7):not([colspan]) { display: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(8),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(8):not([colspan]) { display: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(9),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(9):not([colspan]) { display: none; }
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(10),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(10):not([colspan]) { display: none; }
  /* Keep the short primary identifier on one line */
  #product-development .pd-projects-panel .grid-wrap > table > thead > tr > th:nth-child(2),
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td:nth-child(2) { white-space: nowrap; }
  /* Action / Open control: compact, centered, touch-friendly */
  #product-development .pd-projects-panel .grid-wrap > table .open-cell,
  #product-development .pd-projects-panel .grid-wrap > table .edit-cell,
  #product-development .pd-projects-panel .grid-wrap > table .pd-open-cell,
  #product-development .pd-projects-panel .grid-wrap > table .po-icon-cell {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    padding: 6px 5px;
  }
  #product-development .pd-projects-panel .grid-wrap > table .open-cell a,
  #product-development .pd-projects-panel .grid-wrap > table .edit-cell button,
  #product-development .pd-projects-panel .grid-wrap > table .pd-open-cell button,
  #product-development .pd-projects-panel .grid-wrap > table .po-icon-cell a {
    display: inline-block;
    min-width: 36px;
    min-height: 32px;
    line-height: 1.5;
    padding: 3px 6px;
  }
  #product-development .pd-projects-panel .grid-wrap > table > tbody > tr > td[colspan] {
    text-align: center;
    color: #6a7785;
    white-space: normal;
  }
}
