/* workspace/valet/valet.css: the workspace.valet staged document review dialog.
   Shared tokens from workspace/tokens.css only; plain px/rem sizes (no spacing tokens). */

/* ---- dialog chrome ---- */
.ws-valet-dialog {
  width: min(920px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 48px);
  margin: auto; padding: 0; border: 1px solid var(--hairline-2); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 15px;
  line-height: 1.45; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
/* choosing a file: import card width */
.ws-valet-dialog:has([data-pane="stage"]:not([hidden])) { max-width: 640px; }
.ws-valet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 10px;
  border-bottom: 1px solid var(--hairline); flex: none;
}
.ws-valet-heading { margin: 0; font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--ink); }
/* close: the 1.5px stroke cross of the other dialogs; the text stays its accessible name */
.ws-valet-dialog .ws-valet-x {
  position: relative; min-width: 44px; margin: -8px -10px -8px 0; padding: 0; border: 0;
  background: transparent; color: var(--ink-soft); font-size: 0;
}
.ws-valet-x::before, .ws-valet-x::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 1.5px; border-radius: 1px;
  background: currentColor; transform: rotate(45deg);
}
.ws-valet-x::after { transform: rotate(-45deg); }
.ws-valet-dialog .ws-valet-x:hover { background: var(--paper-3); color: var(--ink); }

.ws-valet-status {
  margin: 0; padding: 8px 20px; min-height: 1.45em; /* no layout shift as status text changes */
  font-size: 13px; color: var(--ink-faint); flex: none;
}
.ws-valet-error {
  margin: 0 20px 8px; padding: 10px 12px; border: 1px solid var(--caution-fg); border-radius: 8px;
  background: var(--caution-bg); color: var(--caution-fg); font-size: 14px; flex: none;
}
/* these set display via their own class, so the UA hidden style needs help */
.ws-valet-error[hidden], .ws-valet-assistrow[hidden], .ws-valet-foot[hidden],
.ws-valet-next-step[hidden] { display: none; }

.ws-valet-body { padding: 4px 20px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.ws-valet-pane[hidden] { display: none; }

/* ---- shared bits ---- */
.ws-valet-sub {
  margin: 16px 0 6px; font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink);
}
.ws-valet-sub2 { margin: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.ws-valet-muted { color: var(--ink-faint); font-size: 13px; margin: 4px 0; }
.ws-valet-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip-low-bg);
  color: var(--chip-low-fg); font-size: 12px; line-height: 1.6; white-space: nowrap;
}
.ws-valet-chip-in { background: var(--chip-high-bg); color: var(--chip-high-fg); }
.ws-valet-chip-out { background: var(--chip-med-bg); color: var(--chip-med-fg); }

.ws-valet-dialog button {
  font-family: var(--font-ui); font-size: 14px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--hairline-2); border-radius: 8px; background: var(--card-bg); color: var(--ink);
  cursor: pointer;
}
.ws-valet-dialog button:hover:not(:disabled) { border-color: var(--ink-faint); }
.ws-valet-dialog button:disabled { opacity: .55; cursor: default; }
/* solid accent fill + white text: >=4.5:1 contrast in both themes, outranks
   the generic dialog button rule and restores the primary hierarchy. */
.ws-valet-dialog button.ws-valet-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.ws-valet-dialog button.ws-valet-primary:hover:not(:disabled) {
  background: var(--accent-soft); border-color: var(--accent-soft);
}
.ws-valet-dialog button.ws-valet-danger { color: var(--caution-fg); }
.ws-valet-retry, .ws-valet-more, .ws-valet-pagebtn { min-height: 36px; padding: 5px 10px; font-size: 13px; }

/* visible focus everywhere inside the dialog */
.ws-valet-dialog :focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }

/* ---- stage pane ---- */
.ws-valet-filelabel { display: block; margin: 12px 0 6px; font-weight: 600; color: var(--ink-soft); }
#ws-valet-file {
  display: block; width: 100%; box-sizing: border-box; padding: 10px; border: 1px dashed var(--hairline-2);
  border-radius: 8px; background: var(--card-bg); color: var(--ink); font-size: 16px; /* no iOS zoom on focus */
  overflow-wrap: anywhere; /* selected filename wraps within 390px */
}
/* the native picker button in the workspace palette (behaviour unchanged) */
#ws-valet-file::file-selector-button {
  font-family: var(--font-ui); font-size: 14px; min-height: 44px; padding: 8px 14px; margin-right: 12px;
  border: 1px solid var(--hairline-2); border-radius: 8px; background: var(--paper-2); color: var(--ink);
  cursor: pointer;
}
#ws-valet-file::file-selector-button:hover { border-color: var(--ink-faint); }
.ws-valet-fmts { margin: 8px 0 14px; color: var(--ink-faint); font-size: 13px; }
#ws-valet-stage { margin-bottom: 8px; }

.ws-valet-recent { margin-top: 18px; }
.ws-valet-recent-err { color: var(--caution-fg); font-size: 14px; }
.ws-valet-recent-list {
  list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--hairline); border-radius: 8px;
  overflow: hidden;
}
.ws-valet-recent-item + .ws-valet-recent-item { border-top: 1px solid var(--hairline); }
.ws-valet-recent-open {
  display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 12px;
  border: 0 !important; border-radius: 0 !important; background: var(--card-bg); text-align: left;
}
.ws-valet-recent-open:hover:not(:disabled) { background: var(--accent-wash); }
.ws-valet-recent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ws-valet-recent-status { color: var(--ink-faint); font-size: 13px; flex: none; }

/* ---- review pane: two columns on desktop ---- */
.ws-valet-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.ws-valet-col { min-width: 0; }

.ws-valet-chapter {
  padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--card-bg);
  margin-bottom: 6px;
}
.ws-valet-chapter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ws-valet-chapter-title { font-weight: 600; overflow-wrap: anywhere; }
.ws-valet-counts { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); }
.ws-valet-coverage { margin: 6px 0 0; font-size: 13px; color: var(--caution-fg); }

.ws-valet-warning {
  padding: 8px 10px; border-left: 3px solid var(--chip-med-fg); background: var(--chip-med-bg);
  border-radius: 0 8px 8px 0; margin-bottom: 6px;
}
.ws-valet-warning-text { margin: 0; font-size: 14px; color: var(--ink); }

.ws-valet-blocklinks { margin: 4px 0; font-size: 13px; color: var(--ink-faint); }
.ws-valet-srclink {
  min-height: 0 !important; padding: 1px 6px !important; font-family: var(--font-mono);
  font-size: 12px !important; color: var(--accent-text);
}

/* ---- decisions ---- */
.ws-valet-decision {
  margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--card-bg);
}
.ws-valet-decision-open { border-color: var(--accent-text); }
.ws-valet-decision legend { padding: 0 4px; font-weight: 600; font-size: 14px; color: var(--ink); }
.ws-valet-opt { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; cursor: pointer; }
.ws-valet-opt input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.ws-valet-omission { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.ws-valet-omission-label {
  display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-size: 14px;
}
.ws-valet-omission-label input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.ws-valet-excluded-review { margin-top: 12px; }

/* ---- source context ---- */
.ws-valet-block {
  padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--card-bg);
  margin-bottom: 6px;
}
.ws-valet-block-text {
  margin: 0; font-family: var(--font-serif); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ws-valet-blank { margin: 0; font-size: 13px; font-style: italic; color: var(--ink-faint); }
.ws-valet-trunc { margin: 4px 0 0; font-size: 12px; font-style: italic; color: var(--ink-faint); }
.ws-valet-srcdetails { margin-top: 4px; }
.ws-valet-srcdetails summary {
  cursor: pointer; min-height: 44px; display: list-item; line-height: 44px; font-size: 12px; color: var(--ink-faint);
}
.ws-valet-srcmeta { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.ws-valet-block-id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.ws-valet-more { margin-top: 4px; }

/* ---- pagination ---- */
.ws-valet-pager { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }

/* ---- policy details ---- */
.ws-valet-policy { margin-top: 18px; border-top: 1px solid var(--hairline); padding-top: 8px; }
.ws-valet-policy summary {
  cursor: pointer; min-height: 44px; display: list-item; line-height: 44px; color: var(--ink-soft); font-size: 14px;
}
.ws-valet-policy-row { margin: 4px 0; font-size: 13px; color: var(--ink-soft); }

/* ---- assistance row ---- */
.ws-valet-assistrow {
  padding: 10px 20px; border-top: 1px solid var(--hairline); background: var(--paper-2); flex: none;
}
.ws-valet-consentlabel {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer;
  margin-bottom: 8px;
}
.ws-valet-consentlabel input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.ws-valet-assist-note { margin: 6px 0 0; font-size: 13px; color: var(--ink-faint); }

/* ---- sticky footer / action area ---- */
.ws-valet-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--hairline); background: var(--paper); flex: none;
}
.ws-valet-next-step { margin: 0; flex: 1 1 240px; font-size: 13px; color: var(--ink-soft); }
.ws-valet-btnrow { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---- brief, quiet transitions ---- */
.ws-valet-dialog button,
.ws-valet-recent-open { transition: background-color .15s ease, border-color .15s ease, opacity .15s ease; }
.ws-valet-chapter, .ws-valet-block, .ws-valet-decision { transition: opacity .15s ease; }

/* ---- small screens: a bottom sheet, one column, no horizontal overflow ---- */
@media (max-width: 640px) {
  .ws-valet-dialog {
    width: 100vw; max-width: 100vw; max-height: 100vh; max-height: 100dvh; /* stay usable with the onscreen keyboard */
    margin: auto 0 0; border-radius: 12px 12px 0 0; border-width: 1px 0 0;
  }
  .ws-valet-cols { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ws-valet-head { padding: 12px 14px 8px; }
  .ws-valet-body { padding: 4px 14px 14px; }
  .ws-valet-status { padding: 6px 14px; }
  .ws-valet-error { margin: 0 14px 8px; }
  .ws-valet-assistrow { padding: 10px 14px; }
  .ws-valet-foot {
    padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    flex-direction: column; align-items: stretch;
  }
  .ws-valet-next-step { flex: 1 1 auto; }
  .ws-valet-btnrow { justify-content: stretch; }
  .ws-valet-btnrow button { flex: 1 1 auto; }
  .ws-valet-recent-open { flex-direction: column; gap: 2px; align-items: stretch; }
  .ws-valet-recent-name { white-space: normal; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-valet-dialog *, .ws-valet-dialog *::before, .ws-valet-dialog *::after { transition: none !important; scroll-behavior: auto !important; }
}
