/*
 * Ref Capture sync popover — final Novo geometry layer.
 * Each section owns exactly one edge so adjoining controls never double up.
 */

html.library-novo1 body.library-workspace-open .ref-capture-sync-popover {
  box-sizing: border-box;
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--novo-line-strong);
  border-radius: 12px;
  background: var(--novo-surface, #fff);
  color: var(--novo-ink);
  box-shadow: 0 14px 38px rgba(9, 29, 45, .14), 0 3px 10px rgba(9, 29, 45, .06);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-popover > header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--novo-line-soft);
  background: #f8fbff;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-brand img {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-brand div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-brand strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-brand span {
  font-size: 10.5px;
  line-height: 1.35;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close {
  position: relative;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--novo-line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--novo-muted);
  box-shadow: none;
  appearance: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close::before,
html.library-novo1 body.library-workspace-open .ref-capture-sync-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close:hover {
  border-color: #aabfce;
  background: var(--novo-surface-soft);
  color: var(--novo-ink);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close:focus {
  outline: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-close:focus-visible {
  border-color: var(--novo-blue);
  box-shadow: var(--novo-focus);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card {
  margin: 16px 16px 12px;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--novo-line-soft);
  border-radius: 10px;
  background: var(--novo-blue-pale);
  box-shadow: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-state-icon {
  box-sizing: border-box;
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 8px;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card strong {
  font-size: 12.5px;
  line-height: 1.3;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card span {
  font-size: 10.5px;
  line-height: 1.4;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card[data-ref-capture-sync-state="connected"],
html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card[data-ref-capture-sync-state="ready"],
html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card[data-ref-capture-sync-state="synced"] {
  border-color: #b9decf;
  background: var(--novo-green-soft);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics {
  margin: 0 16px 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--novo-line-soft);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics > div {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics > div + div {
  border: 0;
  border-left: 1px solid var(--novo-line-soft);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics strong {
  font-size: 18px;
  line-height: 1;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics span {
  font-size: 10px;
  line-height: 1.35;
}

html.library-novo1 body.library-workspace-open .ref-capture-auto-sync {
  margin: 0 16px 12px;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid var(--novo-line-soft);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-auto-sync strong {
  font-size: 11.5px;
  line-height: 1.3;
}

html.library-novo1 body.library-workspace-open .ref-capture-auto-sync small {
  font-size: 10px;
  line-height: 1.35;
}

html.library-novo1 body.library-workspace-open .ref-capture-switch {
  box-sizing: border-box;
  width: 34px;
  height: 20px;
  border-width: 1px;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
  padding: 0 16px 16px;
  border: 0;
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-actions button {
  width: 100%;
  min-width: 0;
  height: 42px;
  margin: 0;
  border-width: 1px;
  border-radius: 9px;
  box-shadow: none;
}

html.library-novo1 body.library-workspace-open .ref-capture-refresh-button {
  border-color: var(--novo-line-strong);
  background: #fff;
  color: var(--novo-ink);
}

html.library-novo1 body.library-workspace-open .ref-capture-refresh-button:hover:not(:disabled) {
  border-color: #91aabd;
  background: var(--novo-surface-soft);
}

html.library-novo1 body.library-workspace-open .ref-capture-sync-now-button:disabled,
html.library-novo1 body.library-workspace-open .ref-capture-refresh-button:disabled {
  border-color: var(--novo-line-soft);
  background: #f5f8fb;
  color: #8ca0af;
  opacity: 1;
}

html.library-novo1 body.library-workspace-open .ref-capture-last-sync {
  margin: 0;
  padding: 10px 16px 11px;
  border: 0;
  border-top: 1px solid var(--novo-line-soft);
  background: #f8fbff;
  font-size: 10px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  html.library-novo1 body.library-workspace-open .ref-capture-sync-popover {
    max-height: calc(var(--library-visual-height, 100dvh) - 92px);
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 430px) {
  html.library-novo1 body.library-workspace-open .ref-capture-sync-popover > header {
    padding-inline: 12px;
  }

  html.library-novo1 body.library-workspace-open .ref-capture-sync-status-card {
    margin: 12px 12px 10px;
  }

  html.library-novo1 body.library-workspace-open .ref-capture-sync-metrics,
  html.library-novo1 body.library-workspace-open .ref-capture-auto-sync {
    margin-right: 12px;
    margin-bottom: 10px;
    margin-left: 12px;
  }

  html.library-novo1 body.library-workspace-open .ref-capture-sync-actions {
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }

  html.library-novo1 body.library-workspace-open .ref-capture-last-sync {
    padding-inline: 12px;
  }
}
