/* The Select Period window, laid out as the reference lays it out.
 *
 * Three list columns of equal width with centred captions, rows as short filled bars with a
 * leading check mark and a hairline gap between them, an options panel to the right, the
 * instrument line bottom-right of that panel, Go To Date bottom-left and Apply & Reload
 * bottom-right. Every colour resolves through the theme tokens so the window changes with the
 * theme like everything else; the geometry is the reference's.
 *
 * This sheet owns every .pp-* rule. It used to be defined in three places by two parallel
 * restyles; one sheet, linked last, is the only way that stays true.
 */

.pp-root { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.pp-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
  padding: 10px 10px 6px 12px;
}

/* ----------------------------------------------------------------- columns */

.pp-cols { display: flex; gap: 8px; flex: 0 0 auto; min-height: 0; }

.pp-col {
  display: flex;
  flex-direction: column;
  width: 138px;
  min-height: 0;
  overflow: hidden;          /* the LIST scrolls, not the column: the caption stays put */
}

.pp-head {
  flex: 0 0 auto;
  padding: 6px 0 8px;
  color: var(--ink);
  font-size: var(--t-md);
  font-weight: 600;
  text-align: center;
}

.pp-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 8px;
  scrollbar-width: thin;
}

/* A row is a short filled bar, the chosen one a shade lighter with its check lit. The check
   column is reserved on every row so nothing shifts sideways when the selection moves. */
.pp-item {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  width: 100%;
  height: 21px;
  padding: 0 6px 0 8px;
  border: 0;
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--ink-dim);
  font: var(--t-md) var(--ui);
  text-align: left;
  cursor: pointer;
}
.pp-item:hover { background: var(--panel-3); color: var(--ink); }
.pp-item.on { background: var(--sel); color: var(--ink); }
.pp-item.off { opacity: .42; cursor: default; }
.pp-item.off:hover { background: var(--panel-2); color: var(--ink-dim); }
.pp-tick {
  flex: 0 0 auto;
  width: 12px;
  color: var(--ink);
  font-size: var(--t-sm);
  text-align: center;
}
.pp-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "+ Add..." and, in Look Back, the bin beside it. */
.pp-addrow { display: flex; align-items: center; gap: 6px; padding-top: 4px; }
.pp-add { flex: 1 1 auto; min-width: 0; }
.pp-addbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-dim);
  font: var(--t-md) var(--ui);
  cursor: pointer;
}
.pp-addbtn:hover { color: var(--ink); background: var(--panel-2); }
.pp-addbtn[hidden] { display: none; }
.pp-custom {
  width: 100%;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-md) var(--mono);
}
.pp-custom[hidden] { display: none; }
.pp-custom:focus { outline: none; border-color: var(--focus); }
.pp-bin {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}
.pp-bin:hover:not(:disabled) { color: var(--ink); background: var(--panel-2); }
.pp-bin:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------------- the options */

.pp-opts {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0 6px 4px;
}

/* Session and time zone: the caption on its own line, bold, the control below with its button. */
.pp-ostack { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.pp-olabel { color: var(--ink); font-size: var(--t-md); font-weight: 600; }
.pp-oline { display: flex; align-items: center; gap: 6px; }

.pp-orow {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: var(--ink-dim);
  font-size: var(--t-md);
  cursor: pointer;
}
.pp-orow:hover { color: var(--ink); }
.pp-orow input[type="checkbox"] { flex: 0 0 auto; width: 14px; height: 14px; margin: 0 2px 0 0; }
.pp-otext { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A row that cannot act is dimmed and says why on hover, rather than being left out. */
.pp-orow.off { opacity: .45; cursor: default; }
.pp-orow.off:hover { color: var(--ink-dim); }

.pp-ogap { height: 10px; flex: 0 0 auto; }

/* Selects with the reference's chevron, numbers with its spinner. */
.pp-selwrap { position: relative; flex: 0 0 auto; display: inline-flex; }
.pp-selwrap.wide { width: 200px; }
.pp-osel {
  width: 114px;
  height: 22px;
  padding: 0 22px 0 7px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--ink);
  font: var(--t-sm) var(--ui);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.pp-selwrap.wide .pp-osel { width: 100%; }
.pp-selchev {
  position: absolute;
  right: 6px;
  top: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-2px);
}
.pp-osel:hover:not(:disabled) { border-color: var(--focus); }
.pp-osel:focus { outline: none; border-color: var(--focus); }
.pp-osel:disabled { opacity: .5; cursor: default; }

.pp-numwrap { flex: 0 0 auto; display: inline-flex; align-items: stretch; height: 22px; }
.pp-onum {
  width: 96px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-right: 0;
  border-radius: 3px 0 0 3px;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-sm) var(--mono);
  text-align: right;
}
.pp-onum:focus { outline: none; border-color: var(--focus); }
.pp-onum:disabled { opacity: .5; }
.pp-spin { display: flex; flex-direction: column; width: 14px; border: 1px solid var(--line-2); border-radius: 0 3px 3px 0; overflow: hidden; }
.pp-spinbtn {
  flex: 1 1 0;
  padding: 0;
  border: 0;
  background: var(--panel-2);
  color: var(--ink-dim);
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
}
.pp-spinbtn + .pp-spinbtn { border-top: 1px solid var(--line-2); }
.pp-spinbtn:hover:not(:disabled) { background: var(--panel-3); color: var(--ink); }
.pp-spinbtn:disabled { opacity: .5; cursor: default; }

/* The small square buttons beside Session and Chart Timezone. */
.pp-ibtn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--ink-dim);
  cursor: pointer;
}
.pp-ibtn:hover { color: var(--ink); border-color: var(--focus); }

/* The instrument's own numbers, bottom right, italic, as the reference prints them. */
.pp-instr {
  margin-top: auto;
  padding-top: 12px;
  color: var(--ink-dim);
  font: var(--t-sm) var(--ui);
  font-style: italic;
  text-align: right;
}

/* -------------------------------------------------------------- the footer */

.pp-foot { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; }
.pp-spacer { flex: 1 1 auto; }

.pp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--ink-dim);
  font: var(--t-md) var(--ui);
  cursor: pointer;
}
.pp-btn:hover { color: var(--ink); border-color: var(--focus); background: var(--panel-3); }
.pp-apply { color: var(--ink); }
.pp-btn:disabled { opacity: .45; cursor: default; }
.pp-btn:disabled:hover { color: var(--ink-dim); border-color: var(--line-2); background: var(--panel-2); }

/* Narrow: the columns stack over the options rather than squeezing them to nothing. */
@media (max-width: 640px) {
  .pp-body { flex-direction: column; overflow-y: auto; }
  .pp-cols { flex: 0 0 auto; }
  .pp-col { width: 0; flex: 1 1 0; }
  .pp-list { max-height: 260px; }
  .pp-opts { overflow: visible; }
}
